P, Q, y0, p0, q0, y = list(map(int, input().split())) p = p0 + (y - y0) q = q0 + (y - y0) print((p-1) % P + 1, (q-1) % Q + 1)