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