P, Q, Y_0, p_0, q_0, Y = map(int, input().split()) d = Y - Y_0 for i in range(d): if p_0 == P: p_0 = 1 else: p_0 += 1 if q_0 == Q: q_0 = 1 else: q_0 += 1 print(p_0, q_0)