P, Q, X, A, B, Y = map(int, input().split()) d = Y - X print((A-1+d)%P + 1, (B-1+d)%Q + 1)