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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tint;

const int N = 2e5 + 5;
const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

pll p[N], ops[N];

struct Query {
	int t, pid, id;
	ll x, y;
};
Query qry[N];

int main() {
	ios::sync_with_stdio(0);

	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> p[i].fi >> p[i].se;

	int m;
	cin >> m;
	for (int i = 1; i <= m; i++) {
		int op, p;
		cin >> op;
		if (op == 3 || op == 4)
			cin >> p;
		ops[i] = make_pair(op, p);
	}

	int q;
	cin >> q;
	for (int i = 1; i <= q; i++) {
		int t, pid;
		cin >> t >> pid;
		qry[i] = (Query){t, pid, i};
	}

	sort(qry + 1, qry + q + 1, [](Query &a, Query &b) {
		return a.t < b.t;
	});

	pll x = make_pair(0, 1);
	pll y = make_pair(0, 1);
	bool flag = 0;

	int id = 1;
	for (int t = 0; t <= m; t++) {
		if (id > q) break;

		if (ops[t].fi == 1) {
			swap(x, y);
			y = make_pair(-y.fi, -y.se);
			flag ^= 1;
		} else if (ops[t].fi == 2) {
			swap(x, y);
			x = make_pair(-x.fi, -x.se);
			flag ^= 1;
		} else if (ops[t].fi == 3) {
			x = make_pair(2LL * ops[t].se - x.fi, -x.se);
		} else if (ops[t].fi == 4) {
			y = make_pair(2LL * ops[t].se - y.fi, -y.se);
		}

		while (qry[id].t == t) {
			auto &o = qry[id];
			ll nx = p[o.pid].fi;
			ll ny = p[o.pid].se;
			if (flag) swap(nx, ny);
			nx = x.fi + x.se * nx;
			ny = y.fi + y.se * ny;
			o.x = nx, o.y = ny;
			id++;
		}
	}

	sort(qry + 1, qry + q + 1, [](Query a, Query b) {
		return a.id < b.id;
	});

	for (int i = 1; i <= q; i++)
		cout << qry[i].x << ' ' << qry[i].y << endl;

	return 0;
}

#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 200005

struct LOC{

	ll x,y;
};

typedef vector<ll> V;
typedef vector<V> MATRIX;

int mat_size = 3;
LOC loc[SIZE];
ll table[SIZE][3][3];


MATRIX calc(MATRIX left,MATRIX right){

	MATRIX ret(mat_size,V(mat_size));

	for(int i = 0; i < mat_size; i++){
		for(int k = 0; k < mat_size; k++)ret[i][k] = 0;
	}

	for(int row = 0; row < mat_size; row++){
		for(int col = 0; col < mat_size; col++){
			for(int a = 0; a < mat_size; a++){
				ret[row][col] += left[row][a]*right[a][col];
			}
		}
	}

	return ret;
}


int main(){

	int num_P;
	scanf("%d",&num_P);

	for(int i = 0; i < num_P; i++){

		scanf("%lld %lld",&loc[i].x,&loc[i].y);
	}


	MATRIX tokei(mat_size,V(mat_size,0));
	tokei[0][1] = 1;
	tokei[1][0] = -1;
	tokei[2][2] = 1;

	MATRIX ccw(mat_size,V(mat_size,0));
	ccw[0][1] = -1;
	ccw[1][0] = 1;
	ccw[2][2] = 1;

	MATRIX move_X(mat_size,V(mat_size,0));
	move_X[0][0] = -1;
	move_X[1][1] = 1;
	move_X[2][2] = 1;

	MATRIX move_Y(mat_size,V(mat_size,0));
	move_Y[0][0] = 1;
	move_Y[1][1] = -1;
	move_Y[2][2] = 1;

	int M;
	scanf("%d",&M);

	MATRIX MULT(mat_size,V(mat_size,0));
	for(int i = 0; i < mat_size; i++){

		MULT[i][i] = 1;
	}

	for(int row = 0; row < 3; row++){
		for(int col = 0; col < 3; col++){

			table[0][row][col] = MULT[row][col];
		}
	}

	int command;
	ll p;

	for(int i = 1; i <= M; i++){

		scanf("%d",&command);

		if(command == 1){

			MULT = calc(tokei,MULT);

		}else if(command == 2){

			MULT = calc(ccw,MULT);

		}else{

			scanf("%lld",&p);
			MATRIX work(mat_size,V(mat_size,0));

			if(command == 3){

				for(int row = 0; row < 3; row++){
					for(int col = 0; col < 3; col++){

						work[row][col] = move_X[row][col];
					}
				}
				work[0][2] = 2*p;

				MULT = calc(work,MULT);

			}else{

				for(int row = 0; row < 3; row++){
					for(int col = 0; col < 3; col++){

						work[row][col] = move_Y[row][col];
					}
				}
				work[1][2] = 2*p;

				MULT = calc(work,MULT);
			}
		}

		for(int row = 0; row < 3; row++){
			for(int col = 0; col < 3; col++){

				table[i][row][col] = MULT[row][col];
			}
		}
	}

	int num_Q;
	scanf("%d",&num_Q);

	int a,b;

	for(int loop = 0; loop < num_Q; loop++){

		scanf("%d %d",&a,&b);

		b--;

		ll x = table[a][0][0]*loc[b].x + table[a][0][1]*loc[b].y + table[a][0][2];
		ll y = table[a][1][0]*loc[b].x + table[a][1][1]*loc[b].y + table[a][1][2];

		printf("%lld %lld\n",x,y);
	}

	return 0;
}
