p,q,y0,p0,q0,y=[*map(int,input().split())] d=y-y0 np=(p0-1+d)%p+1 nq=(q0-1+d)%q+1 print(np,nq)