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