#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef vector<P> vp;
typedef tuple<int, int, P> T;
typedef vector<T> vt;
typedef vector<vl> vvl;

// input
int N;
vl X, Y;
int M;
vp op;
int Q;
vi A, B;


void input() {
    cin >> N;
    X = Y = vl(N);
    rep(i, N) cin >> X[i] >> Y[i];
    cin >> M;
    op = vp(M);
    rep(i, M) {
        cin >> op[i].first;
        if (op[i].first > 2) cin >> op[i].second;
    }
    cin >> Q;
    A = B = vi(Q);
    rep(i, Q) cin >> A[i] >> B[i];
}


vvl multi(vvl &a, vvl &b) {
    int r1 = a.size(), c1 = a[0].size();
    int r2 = b.size(), c2 = b[0].size();
    assert(c1 == r2);
    vvl ret(r1, vl(c2, 0));
    rep(i, r1) rep(j, c2) {
        rep(k, c1) ret[i][j] += a[i][k] * b[k][j];
    }
    return ret;
}


int main() {
    input();
    vector<vvl> w(M + 1);
    w[0] = {
        {1, 0, 0},
        {0, 1, 0},
        {0, 0, 1},
    };
    rep(i, M) {
        ll o, p;
        tie(o, p) = op[i];
        vvl d;
        if (o == 1) {
            d = {
                {0, 1, 0},
                {-1, 0, 0},
                {0, 0, 1},
            };
        } else if (o == 2) {
            d = {
                {0, -1, 0},
                {1, 0, 0},
                {0, 0, 1},
            };
        } else if (o == 3) {
            d = {
                {-1, 0, 2 * p},
                {0, 1, 0},
                {0, 0, 1},
            };
        } else {
            d = {
                {1, 0, 0},
                {0, -1, 2 * p},
                {0, 0, 1},
            };
        }
        w[i + 1] = multi(d, w[i]);
    }
    rep(i, Q) {
        vvl mat = {
            {X[B[i] - 1]},
            {Y[B[i] - 1]},
            {1},
        };
        vvl ans = multi(w[A[i]], mat);
        printf("%lld %lld\n", ans[0][0], ans[1][0]);
    }
}

#include <iostream>
using namespace std;
typedef long long ll;

struct State{
    int dir;
    bool xrev, yrev;
    ll dx, dy;
};

int main()
{
    int n;
    cin >> n;
    ll x[200005], y[200005];
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
    int m;
    cin >> m;
    State state[200005];
    state[0] = (State){0, false, false, 0, 0};
    for(int i = 1; i <= m; i++){
        state[i] = state[i - 1];
        int t;
        cin >> t;
        if(t == 1) state[i].dir = (state[i].dir + 1) % 4;
        if(t == 2) state[i].dir = (state[i].dir + 3) % 4;
        if(t == 3){
            ll p;
            cin >> p;
            if(state[i].dir >= 2) p = -p;
            if(!(state[i].dir % 2)){
                if(state[i].xrev) state[i].dx += p * 2;
                else state[i].dx -= p * 2;
                state[i].xrev ^= true;
            }
            else{
                if(state[i].yrev) state[i].dy += p * 2;
                else state[i].dy -= p * 2;
                state[i].yrev ^= true;
            }
        }
        if(t == 4){
            ll p;
            cin >> p;
            if(state[i].dir == 1 || state[i].dir == 2) p = -p;
            if(state[i].dir % 2){
                if(state[i].xrev) state[i].dx += p * 2;
                else state[i].dx -= p * 2;
                state[i].xrev ^= true;
            }
            else{
                if(state[i].yrev) state[i].dy += p * 2;
                else state[i].dy -= p * 2;
                state[i].yrev ^= true;
            }
        }
    }
    int q;
    cin >> q;
    while(q--){
        int a, b;
        cin >> a >> b;
        b--;
        ll u, v;
        if(state[a].xrev) u = -x[b] - state[a].dx;
        else u = x[b] + state[a].dx;
        if(state[a].yrev) v = -y[b] - state[a].dy;
        else v = y[b] + state[a].dy;
        for(int i = 0; i < state[a].dir; i++){
            swap(u, v);
            v = -v;
        }
        cout << u << " " << v << endl;
    }
}
