P, Q, Y0, P0, Q0, Y = map(int, input().split()) for i in range(Y0, Y): P0 = 1 if P0 == P else P0+1 Q0 = 1 if Q0 == Q else Q0+1 print(P0, Q0)