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

const int MAX_N = 2e5+2;
int n;
pair<ll,ll> p[MAX_N];
int m;
ll t[MAX_N],axis[MAX_N];
int q;
ll A[MAX_N], B[MAX_N];
pair<ll,ll> ans[MAX_N];

struct query
{
    ll a, b, id;
    bool operator<(const query& other) const
    {
        return a < other.a;    
    }
};

void solve()
{
	vector<query> Q;
	for(int i=0;i<q;++i)Q.emplace_back(query{A[i],B[i],i});
	sort(Q.begin(),Q.end());
	ll sw=0,sx=1,sy=1;
	ll cx=0,cy=0;
	int idx=1;
	for(int i=0;i<q;++i){
		for(; idx<=m && idx<=Q[i].a; ++idx){
			if(t[idx]==1){
				sw ^= 1;
				swap(cx,cy), swap(sx,sy);
				cy*=-1,sy*=-1;
			}else if(t[idx]==2){
				sw ^= 1;
				swap(cx,cy), swap(sx,sy);
				cx*=-1,sx*=-1;
			}else if(t[idx]==3){
				sx*=-1,cx*=-1;
				cx+=2LL*axis[idx];
			}else{
				sy*=-1,cy*=-1;
				cy+=2LL*axis[idx];
			}
		}
		if(!sw){
		    ans[Q[i].id].first =sx*p[Q[i].b].first+cx;
		    ans[Q[i].id].second=sy*p[Q[i].b].second+cy;
		}
		else{
		    ans[Q[i].id].first=sx*p[Q[i].b].second+cx;
		    ans[Q[i].id].second=sy*p[Q[i].b].first+cy;
		}
	}
	for(int i=0;i<q;++i)cout<<ans[i].first<<' '<<ans[i].second<<'\n';
}

int main()
{
  	ios::sync_with_stdio(false);
  	cin.tie(nullptr);
    cout.tie(nullptr);
	cin >> n;
	for(int i=1;i<=n;++i)cin>>p[i].first>>p[i].second;
	cin >> m;
	for(int i=1;i<=m;++i){
		cin >> t[i];
		if(t[i]==3 || t[i]==4) cin>>axis[i];
	}
	cin >> q;
	for(int i=0;i<q;++i)cin>>A[i]>>B[i];
	solve();
	return 0;
}
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1001001001;
const long long LINF = 1001002003004005006;
const double PI = acos(-1);
int d4r[] = {1, 0, -1, 0};
int d4c[] = {0, 1, 0, -1};
int d8r[] = {1, 1, 0, -1, -1, -1, 0, 1};
int d8c[] = {0, 1, 1, 1, 0, -1, -1, -1};

vector<vector<long long>> prod(vector<vector<long long>> a, vector<vector<long long>> b) {
    vector<vector<long long>> res(a.size(), vector<long long>(b[0].size()));
    for(int i = 0;i < res.size();++i) {
        for(int j = 0;j < res[0].size();++j) {
            res[i][j] = 0;
            for(int k = 0;k < a[0].size();++k) {
                res[i][j] += a[i][k] * b[k][j];
            }
        }
    }
    return res;
}

struct operation{
    vector<vector<vector<long long>>> op_matrix;
    operation(int m){
        op_matrix.push_back({{1,0,0},{0,1,0},{0,0,1}});
    }
    void make_matrix() {
        int op_num; cin >> op_num;
        vector<vector<long long>> new_matrix(3, vector<long long>(3));
        if(op_num == 1) {
            new_matrix = prod({{0,1,0},{-1,0,0},{0,0,1}},op_matrix.back());
            op_matrix.push_back(new_matrix);
        }
        else if(op_num == 2) {
            new_matrix = prod({{0,-1,0},{1,0,0},{0,0,1}},op_matrix.back());
            op_matrix.push_back(new_matrix);
        }
        else if(op_num == 3) {
            long long p; cin >> p;
            new_matrix = prod({{-1,0,2 * p},{0,1,0},{0,0,1}},op_matrix.back());
            op_matrix.push_back(new_matrix);
        }
        else {
            long long p; cin >> p;
            new_matrix = prod({{1,0,0},{0,-1,2 * p},{0,0,1}},op_matrix.back());
            op_matrix.push_back(new_matrix);
        }
        return;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    vector<long long> x(n), y(n);
    for(int i = 0;i < n;++i) {
        cin >> x[i] >> y[i];
    }
    int m; cin >> m;
    operation op(m);
    for(int i = 0;i < m;++i) {
        op.make_matrix();
    }
    // for(int i = 0;i < 3;++i) {
    //     for(int j = 0;j < 3;++j) {
    //         cout << op.op_matrix[0][i][j] << " ";
    //     }
    //     cout << endl;
    // }
    int q; cin >> q;
    for(int i = 0;i < q;++i) {
        int a, b; cin >> a >> b;
        b--;
        vector<vector<long long>> init(3,vector<long long>(1));
        init[0][0] = x[b];
        init[1][0] = y[b];
        init[2][0] = 1;
        vector<vector<long long>> ans = prod(op.op_matrix[a],init);
        cout << ans[0][0] << " " << ans[1][0] << '\n';
    }
    return 0;
}