P, Q, Y0, P0, Q0, Y = map(int,input().split()) a = (P0 + (Y - Y0)) % P b = (Q0 + (Y - Y0)) % Q if a == 0: a = P if b == 0: b = Q print(a, b)