数学题,"全反射问题"简化为"求指向对称点的向量"即可。

from math import gcd
n, h = map(int, input().split())

for idx in range(n):
    x, y, z = map(int, input().split())
    tz = 2 * h - z
    g = gcd(x, y, tz)
    tx = int(x // g)
    ty = int(y // g)
    tz = int(tz // g)
    print(tx, ty, tz)