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