p, q, y0, p0, q0, y = [int(x) for x in input().split()] py = p0 - 1 qy = q0 - 1 d = y = y0 py += d qy += d py %= p qy %= q print(py + 1, qy + 1)