#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long double ld;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;

ll result[9];
ll p[9];
ll q[9];
ll all[9];

void product(){
    result[0] = p[0]*q[0]+p[1]*q[3]+p[2]*q[6];
    result[1] = p[0]*q[1]+p[1]*q[4]+p[2]*q[7];
    result[2] = p[0]*q[2]+p[1]*q[5]+p[2]*q[8];
    result[3] = p[3]*q[0]+p[4]*q[3]+p[5]*q[6];
    result[4] = p[3]*q[1]+p[4]*q[4]+p[5]*q[7];
    result[5] = p[3]*q[2]+p[4]*q[5]+p[5]*q[8];
    result[6] = p[6]*q[0]+p[7]*q[3]+p[8]*q[6];
    result[7] = p[6]*q[1]+p[7]*q[4]+p[8]*q[7];
    result[8] = p[6]*q[2]+p[7]*q[5]+p[8]*q[8];
    return;
}


void solve(){

    ll n;
    cin >> n;
    vector<pair<ll,ll>> v;
    rep(i,n){
        ll x,y;
        cin >> x >> y;
        v.eb(make_pair(x,y));
    }
    ll m;
    cin >> m;
    rep(i,9){
        q[i]=0;
    }
    q[0]=1;
    q[4]=1;
    q[8]=1;
    vector<tuple<ll,ll,ll,ll,ll,ll,ll,ll,ll>> vt;
    vt.eb(make_tuple(1,0,0,0,1,0,0,0,1));
    rep(i,m){
        ll op;
        cin >> op;
        
        if(op==2){
            p[0]=0;
            p[1]=-1;
            p[2]=0;
            p[3]=1;
            p[4]=0;
            p[5]=0;
            p[6]=0;
            p[7]=0;
            p[8]=1;
        }
        else if(op==1){
            p[0]=0;
            p[1]=1;
            p[2]=0;
            p[3]=-1;
            p[4]=0;
            p[5]=0;
            p[6]=0;
            p[7]=0;
            p[8]=1;
        }
        else if(op==3){
            ll p_;
            cin >> p_;
            p[0]=-1;
            p[1]=0;
            p[2]=2*p_;
            p[3]=0;
            p[4]=1;
            p[5]=0;
            p[6]=0;
            p[7]=0;
            p[8]=1;
        }
        else{
            ll p_;
            cin >> p_;
            p[0]=1;
            p[1]=0;
            p[2]=0;
            p[3]=0;
            p[4]=-1;
            p[5]=2*p_;
            p[6]=0;
            p[7]=0;
            p[8]=1;
        }
        product();
        rep(j,9) q[j] = result[j];
        vt.eb(make_tuple(result[0],result[1],result[2],result[3],result[4],result[5],result[6],result[7],result[8]));
        rep(i,9){
            //cout << result[i] << " ";
        }
        //cout << endl;
    }
    rep(i,9) all[i]=result[i];

    ll query;
    cin >> query;
    rep(i, query){
        ll a,b;
        cin >> a >> b;
        ll cx = v[b-1].first;
        ll cy = v[b-1].second;
        ll ansx = get<0>(vt[a])*cx + get<1>(vt[a])*cy + get<2>(vt[a]);
        ll ansy = get<3>(vt[a])*cx + get<4>(vt[a])*cy + get<5>(vt[a]);
        cout << ansx << " " << ansy << endl;
    }

}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using vll = vector<LL>;

const vector<vll> CW = {{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}};
const vector<vll> CCW = {{0, -1, 0}, {1, 0, 0}, {0, 0, 1}};

vector<vll> multiply(vector<vll>& A, vector<vll>& B){
    int m = A.size(), n = B.size(), p = B[0].size();
    vector<vll> answer(m, vll(p, 0));

    for (int i = 0; i < m; i++){
        for (int j = 0; j < p; ++j){
            for (int k = 0; k < n; ++k){
                answer[i][j] += A[i][k] * B[k][j];
            }
        }
    }
    return answer;
}

void print_matrix(vector<vll>& A){
    for (int i = 0; i < A.size(); ++i){
        for (int j = 0; j < A[i].size(); ++j){
            cout << A[i][j] << (j != A[i].size() - 1 ? ' ' : '\n');
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    vector<vector<vll>> pieces(n);
    for (int i = 0; i < n; ++i){
        int x, y; cin >> x >> y;
        pieces[i] = {{x},{y},{1}};
    }

    int m; cin >> m;
    vector<vector<vll>> ops(m + 1);
    ops[0] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
    for (int i = 1; i <= m; ++i){
        int op; cin >> op;
        if (op == 1){
            ops[i] = CW;
        }
        else if (op == 2){
            ops[i] = CCW;
        }
        else if (op == 3){
            int p; cin >> p;
            ops[i] = {{-1 , 0, 2 * p}, {0, 1, 0}, {0, 0, 1}};
        }
        else{
            int p; cin >> p;
            ops[i] = {{1, 0, 0}, {0, -1, 2 * p}, {0, 0, 1}};
        }
    }
    for (int i = 1; i <= m; ++i){
        ops[i] = multiply(ops[i], ops[i - 1]);
    }

    int q; cin >> q;
    for (int i = 0; i < q; ++i){
        int a, b; cin >> a >> b;
        b--;
        vector<vll> res = multiply(ops[a], pieces[b]);
        cout << res[0][0] << ' ' << res[1][0] << '\n';
    }
    return 0;
}