#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) templatebool chmax(T &x, T y){if(x>=y)return false;x=y;return true;} templatebool chmin(T &x, T y){if(x<=y)return false;x=y;return true;} int main(){ int P, Q, Y, p, q, y; cin >> P >> Q >> Y >> p >> q >> y; y -= Y; cout << (p-1+y+P)%P+1 << ' ' << (q-1+y+Q)%Q+1 << endl; }