#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
using namespace __gnu_pbds;
using namespace std;
using ld = long double;
using ll = long long;

int n, m, q, x[200001], y[200001];
pair<int, int> op[200001];
vector<pair<int, int>> que[200001];
pair<ll, ll> ans[200000];

int main(){
    //IO("input.txt", "output.txt");
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> x[i] >> y[i];
    cin >> m;
    for(int i = 1; i <= m; i++){
        int typ, p;
        cin >> typ;
        if(typ < 3) op[i] = make_pair(typ, 0);
        else{
            cin >> p;
            op[i] = make_pair(typ, p);
        }
    }
    cin >> q;
    for(int i = 0; i < q; i++){
        int a, b;
        cin >> a >> b;
        que[a].emplace_back(b, i);
    }
    for(auto i : que[0])
        ans[i.second] = make_pair(x[i.first], y[i.first]);
    bool rev = false;
    ll px = 0, sx = 1, py = 0, sy = 1;
    for(int i = 1; i <= m; i++){
        if(op[i].first < 3){
            if(rev) op[i].first = (op[i].first == 1) ? 2 : 1;
            if(op[i].first == 1) sx *= -1, px *= -1;
            else sy *= -1, py *= -1;
            rev ^= true;
        }else{
            if(rev) op[i].first = (op[i].first == 3) ? 4 : 3;
            if(op[i].first == 3)
                px = 2 * op[i].second - px, sx *= -1;
            else
                py = 2 * op[i].second - py, sy *= -1;
        }
        for(auto j : que[i]){
            pair<ll, ll> res = make_pair(px + sx * x[j.first], py + sy * y[j.first]);
            if(rev) swap(res.first, res.second);
            ans[j.second] = res;
        }
    }
    for(int i = 0; i < q; i++)
        cout << ans[i].first << ' ' << ans[i].second << '\n';
    return 0;
}

/*
90 deg clockwise is: (x, y) -> (y, -x)
90 deg counterclockwise is: (x, y) -> (-y, x)
reflection across x = p is: (x, y) -> (2 * p - x, y)
reflection across y = p is: (x, y) -> (x, 2 * p - y)
*/
#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int, int>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rrep(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr ll INF = 1LL << 30;
constexpr ll mod = 10007; //(ll)1e9 + 7;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
inline void init() {
    cin.tie(nullptr); cout.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
}

vector<vector<ll>>func(vector<vector<ll>>A, vector<vector<ll>>B) {
    vector<vector<ll>>res(vector<vector<ll>>(A.size(), vector<ll>(B[0].size())));
    rep(i, 0, res.size()) {
        rep(j, 0, res[i].size()) {
            ll a = 0;
            rep(k, 0, 3) {
                a += A[i][k] * B[k][j];
            }
            res[i][j] = a;
        }
    }
    return res;
}
int main() {
    init();

    int N; cin >> N;
    vector<P>XY(N);
    rep(i, 0, N) {
        int a, b; cin >> a >> b;
        XY[i] = { a,b };
    }
    int M; cin >> M;
    vector<vector<vector<ll>>>O(M, vector<vector<ll>>(3, vector<ll>(3)));
    rep(i, 0, M) {
        int a;cin >> a;
        vector<vector<ll>>A(vector<vector<ll>>(3, vector<ll>(3)));
        if (a == 1) {
            A = { {0,1,0},
                {-1,0,0},
                {0,0,1} };
        }
        if (a == 2) {
            A = { {0,-1,0},
                {1,0,0},
                {0,0,1} };
        }
        if (a == 3) {
            int p; cin >> p;
            A = { {-1,0,2 * p},
                {0,1,0},
                {0,0,1} };
        }
        if (a == 4) {
            int p; cin >> p;
             A = { {1,0,0},
                {0,-1,2*p},
                {0,0,1} };
        }
        if (i == 0)O[i] = A;
        else O[i] = func(A, O[i-1]);
    }
    int Q; cin >> Q;
    rep(i, 0, Q) {
        int a, b; cin >> a >> b;
        --b;
        if (a == 0) {
            cout << XY[b].first << " " << XY[b].second << "\n";
        }
        else {
            --a;
            vector<vector<ll>>B =
            { {XY[b].first},
                {XY[b].second},
                {1} };
            auto ans = func(O[a], B);
            cout << ans[0][0] << " " << ans[1][0] << "\n";
        }
    }

    return 0;
}