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