P, Q, Y0, p0, q0, Y = map(int, input().split()) p0 += Y - Y0 q0 += Y - Y0 p0 %= P q0 %= Q if p0 == 0: p0 = P if q0 == 0: q0 = Q print(p0, q0)