P, Q, Y0, p0, q0, Y = map(int, input().split()) d = Y -Y0 s1, p = divmod(p0 + d - 1, P) s2, q = divmod(q0 + d - 1, Q) p = p+1 q = q+1 print(p, q)