#include<bits/stdc++.h> #define ll long long #define INF 1e9 usingnamespace std; int n, m, x, y, z, p; int X[100005], Y[100005]; voidsolve_x(){ for (int i = 1; i <= p; i++) { int tmp = X[i]; X[i] = Y[i]; Y[i] = n - tmp + 1; } swap(n, m); // 交换 } voidsolve_y(){ for (int i = 1; i <= p; i++) Y[i] = m - Y[i] + 1; } voidsolve_z(){ for (int i = 1; i <= p; i++) { int tmp = Y[i]; Y[i] = X[i]; X[i] = m - tmp + 1; } swap(n, m); // 交换 } signedmain(){ ios :: sync_with_stdio(0); cin >> n >> m >> x >> y >> z >> p; x %= 4, y %= 2, z %= 4; // 注意取模 for (int i = 1; i <= p; i++) cin >> X[i] >> Y[i]; for (int i = 1; i <= x; i++) solve_x(); for (int i = 1; i <= y; i++) solve_y(); for (int i = 1; i <= z; i++) solve_z(); for (int i = 1; i <= p; i++) cout << X[i] << " " << Y[i] << "\n"; return0; }