P, Q, Y_0, p_0, q_0, Y = map(int, input().split()) p = p_0 q = q_0 if Y >= Y_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) else: d = Y_0 - Y for i in range(d): if p == 1: p = P else: p -= 1 if q == 1: q = Q else: q -= 1 print(p, q)