p, q, y0, p0, q0, y = map(int, input().split()) d = y - y0 pa = (p0 + d) % p qa = (q0 + d) % q if pa == 0: pa = p if qa == 0: qa = q print(pa, qa)