p, q, y0, p0, q0, y = map(int, input().split()) d = (y - y0) + p * q * abs(y - y0) print(((p0 + d - 1) % p) + 1, ((q0 + d - 1) % q) + 1)