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