#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
struct query{int time,type;ll p;int idx;};
bool operator<(const query &a,const query &b){
    return a.time<b.time;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,m,q;
    ll x[200010],y[200010],nx=0,ny=0,ax[200010],ay[200010];
    bool fx=false,fy=false,sw=false;
    cin>>n;
    vector<query>qs;
    rep(i,n)cin>>x[i]>>y[i];
    cin>>m;
    rep(i,m){
        int type;
        cin>>type;
        if(type==1||type==2)qs.pb({2*i,type,-1,-1});
        if(type==3||type==4){
            ll p;
            cin>>p;
            qs.pb({2*i,type,p,-1});
        }
    }
    cin>>q;
    rep(i,q){
        int a,b;
        cin>>a>>b;
        a--,b--;
        qs.pb({2*a+1,0,b,i});
    }
    sort(all(qs));
    for(auto[time,type,p,idx]:qs){
        if(type==1){
            if(sw==0){
                fx=!fx;
                nx=-nx;
            }
            if(sw==1){
                fy=!fy;
                ny=-ny;
            }
            sw=!sw;
        }
        if(type==2){
            if(sw==0){
                fy=!fy;
                ny=-ny;
            }
            if(sw==1){
                nx=-nx;
                fx=!fx;
            }
            sw=!sw;
        }
        if(type==3){
            if(sw==0){
                fx=!fx;
                nx=-nx+p*2;
            }
            if(sw==1){
                fy=!fy;
                ny=-ny+p*2;
            }
        }
        if(type==4){
            if(sw==0){
                fy=!fy;
                ny=-ny+p*2;
            }
            if(sw==1){
                fx=!fx;
                nx=-nx+p*2;
            }
        }
        if(type==0){
            if(sw==0){
                if(fx==0)ax[idx]=x[p]+nx;
                if(fx==1)ax[idx]=-x[p]+nx;
                if(fy==0)ay[idx]=y[p]+ny;
                if(fy==1)ay[idx]=-y[p]+ny;
            }
            if(sw==1){
                if(fy==0)ax[idx]=y[p]+ny;
                if(fy==1)ax[idx]=-y[p]+ny;
                if(fx==0)ay[idx]=x[p]+nx;
                if(fx==1)ay[idx]=-x[p]+nx;
            }
            
        }
    }
    rep(i,q)cout<<ax[i]<<" "<<ay[i]<<endl;
    return 0;
}
#include <iostream>
#include <algorithm>
#include <queue>
#include <bitset>
#include <string>
#include <cstring>
#include <limits>
#include <cmath>
#include <cstdlib>
#define int long long

int const INF = std::numeric_limits<int>::max();
int const NINF = std::numeric_limits<int>::min();
int const N = 200000;
int const M = N;
int const Q = N;

struct Point {
	int x, y;
};

struct Oper {
	int op;
	int p;
};

struct Query {
	int oper;
	int point;
	int index;
	bool operator<(const Query &other) const {
		return oper < other.oper;
	}
};

struct Tag {
	int add;
	int times = 1;
};

Point points[N + 1];
Oper opers[M + 1];
Query queries[Q + 1];
Tag xtag;
Tag ytag;
int swaps;
int x_ans[Q + 1];
int y_ans[Q + 1];

void plus(int, Tag&);
void times(int, Tag&);

void plus(int v, Tag &tag) {
	tag.add += v;
}

void times(int v, Tag &tag) {
	tag.add *= v;
	tag.times *= v;
}

signed main()  {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);
	
	int n, m;
	std::cin >> n;
	
	for (int i = 1; i <= n; i++) {
		std::cin >> points[i].x >> points[i].y;	
	}
	
	std::cin >> m;
	for (int i = 1; i <= m; i++) {
		std::cin >> opers[i].op;
		if (opers[i].op >= 3) {
			std::cin >> opers[i].p;
		}
	}
	
	int q;
	std::cin >> q;
	
	for (int i = 1; i <= q; i++) {
		std::cin >> queries[i].oper >> queries[i].point;
		queries[i].index = i;
	}
	
	std::sort(queries + 1, queries + 1 + q);
	
	int pointer = 1;
	for (int i = 1; i <= m; i++) {
		while (pointer <= q && i > queries[pointer].oper) {
			int x = points[queries[pointer].point].x;
			int y = points[queries[pointer].point].y;
			
			if (swaps % 2) {
				std::swap(x, y);
			}
			
			x_ans[queries[pointer].index] = x * xtag.times + xtag.add;
			y_ans[queries[pointer].index] = y * ytag.times + ytag.add;
			
			pointer++;
		}
		
		int op = opers[i].op;
		int p = opers[i].p;
		
		if (op == 1) {
			swaps++;
			std::swap(xtag, ytag);
			times(-1, ytag);
		}
		else if (op == 2) {
			swaps++;
			std::swap(xtag, ytag);
			times(-1, xtag);
		}
		else if (op == 3) {
			times(-1, xtag);
			plus(2 * p, xtag);
		}
		else {
			times(-1, ytag);
			plus(2 * p, ytag);
		}
	}
	
	while (pointer <= q) {
		int x = points[queries[pointer].point].x;
		int y = points[queries[pointer].point].y;
		
		if (swaps % 2) {
			std::swap(x, y);
		}
		
		x_ans[queries[pointer].index] = x * xtag.times + xtag.add;
		y_ans[queries[pointer].index] = y * ytag.times + ytag.add;
		
		pointer++;
	}
	
	for (int i = 1; i <= q; i++) {
		std::cout << x_ans[i] << ' ' << y_ans[i] << '\n';
	}
	
	return 0;
}