p,q,y0,p0,q0,y=map(int,input().split()) print((p0+y-y0-1)%p+1,(q0+y-y0-1)%q+1)