#include <bits/stdc++.h>
using namespace std;

#define int long long 


int32_t main() {
    int N;cin>>N;
    vector<pair<int,int>>points(N);
    
    // taking points
    for(int i=0,x,y;i<N;i++){
        cin>>x>>y;
        points[i].first = x;
        points[i].second = y;
    }
    
    int m;cin>>m;
    vector<pair<int,int>>op(m);
    
    // taking operations 
    
    for(int i=0;i<m;i++){
        cin>>op[i].first;
        if(op[i].first > 2) cin>>op[i].second;
    }
    
    int q;cin>>q;
    vector<pair<pair<int,int>,int>>queries(q);
    
    for(int i=0;i<q;i++){
        cin>>queries[i].first.first>>queries[i].first.second;
        queries[i].second = i;
    }
    
    sort(queries.begin(),queries.end());
    
    vector<pair<int,int>>ans(q);
    int idx = 0 , sx = 1 , sy = 1 , a = 0 , b = 0 ;
    bool swapped = 0;
    
    
    for(int i=0;i<q;i++){
        while(idx < queries[i].first.first) {
            if(op[idx].first == 1){
                swap(sx, sy);
                swap(a,b);
                swapped ^= 1;
                sy = -sy;
                b = -b;
            }
            else if(op[idx].first == 2){
                swap(sx, sy);
                swap(a, b);
                swapped ^= 1;
                sx = -sx;
                a = -a;
            }
            else if(op[idx].first == 3){
                a = 2*op[idx].second - a;
                sx = -sx;
            }
            else{
                b = 2 * op[idx].second - b;
                sy = -sy;
            }
            idx++;
        }
        
        int id = queries[i].second;
        int p_id = queries[i].first.second - 1;
        
        if(swapped){
            ans[id] = {points[p_id].second*sx + a , points[p_id].first*sy + b};
        }
        else{
            ans[id] = {points[p_id].first*sx + a , points[p_id].second * sy + b};
        }
        
    }
    
    for(auto p : ans) {
        cout<<p.first<<" "<<p.second<<endl;
    }
    
}
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (n); i++)

#define N 200005
struct Mat { ll m[3][3]; };
Mat op[N], nd[N], p[5], cur;
Mat mul(Mat x, Mat y) {
    Mat tmp;
    rep(i,3)rep(j,3) {
        tmp.m[i][j] = 0;
        rep(k,3) {
            tmp.m[i][j] += x.m[i][k] * y.m[k][j];
        }
    }
    return tmp;
}

int main() {
    int n;
    cin >> n;
    p[1].m[0][1] = -1; p[1].m[1][0] = 1;
    p[2].m[0][1] = 1; p[2].m[1][0] = -1;
    p[3].m[0][0] = -1; p[3].m[1][1] = 1;
    p[4].m[0][0] = 1; p[4].m[1][1] = -1;
    p[1].m[2][2] = p[2].m[2][2] = p[3].m[2][2] = p[4].m[2][2] = 1;
    for(int i = 1; i <= n; i++) {
        cin >> nd[i].m[0][0] >> nd[i].m[0][1];
        nd[i].m[0][2] = 1;
    }
    int m;
    cin >> m;
    rep(i,3) op[0].m[i][i] = 1;
    for(int i = 1; i <= m; i++) {
        int x, y;
        cin >> x;
        if(x == 3) {
            cin >> y;
            p[3].m[2][0] = 2*y;
        } else if(x == 4) {
            cin >> y;
            p[4].m[2][1] = 2*y;
        }
        op[i] = mul(op[i-1], p[x]);
    }
    int q;
    cin >> q;
    while(q--) {
        int a, b;
        cin >> a >> b;
        cur = mul(nd[b], op[a]);
        cout << cur.m[0][0] << " " << cur.m[0][1] << endl;
    }
    return 0;
}