P, Q, S, a, b, T = map(int, input().split()) a, b = a-1, b-1 a += (T-S) a %= P b += (T-S) b %= Q print(a+1, b+1)