#include <iostream>
#include <vector>
#include <map>
using namespace std;

int N, M, Q;
long long int X[200005], Y[200005];
int op[200005],A[200005], B[200005];
long long int p[200005];

vector<int> V[200005];

map<pair<int, int>, int> MAP;

long long int a[4], b[4];
long long int tmp[4];

void QUERY(int k, int p_val) {

	if (k == 1) {
		for (int i = 1; i <= 3; i++) { tmp[i] = a[i]; }
		for (int i = 1; i <= 3; i++) { a[i] = b[i];  b[i] = -tmp[i]; }
	}
	else if (k == 2) {
		for (int i = 1; i <= 3; i++) { tmp[i] = a[i]; }
		for (int i = 1; i <= 3; i++) { a[i] = -b[i]; b[i] = tmp[i]; }
	}
	else if (k == 3) {
		//for (int i = 1; i <= 3; i++) { tmp[i] = a[i]; }
		a[3] = 2 * p_val - a[3]; a[1] = -a[1]; a[2] = -a[2];
	}
	else if (k == 4) {
		b[3] = 2 * p_val - b[3]; b[1] = -b[1]; b[2] = -b[2];
	}
}

long long int ans_x[200005], ans_y[200005];

int main(void) {
	cin >> N;

	for (int i = 1; i <= N; i++) {
		cin >> X[i] >> Y[i];
	}

	cin >> M;
	for (int i = 1; i <= M; i++) {
		cin >> op[i];
		if (op[i] >= 3) { cin >> p[i]; }
	}
	cin >> Q;
	for (int i = 1; i <= Q; i++) {
		cin >> A[i] >> B[i];
		V[A[i]].push_back(B[i]);
		MAP[make_pair(A[i], B[i])] = i;
	}


	a[1] = 1; 
	b[2] = 1;

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

	//	cout << "op= " << op[i] << endl;
		QUERY(op[i], p[i]);

		//cout << "a : " << a[1] << " " << a[2] << " " << a[3] << endl;
		//cout << "b : " << b[1] << " " << b[2] << " " << b[3] << endl;

		for (auto y : V[i]) {
			int I = MAP[make_pair(i, y)];
			ans_x[I] = a[1] * X[y] + a[2] * Y[y] + a[3];
			ans_y[I] = b[1] * X[y] + b[2] * Y[y] + b[3];
	  }
	}

	for (int i = 1; i <= Q; i++) {
		int I = MAP[make_pair(A[i], B[i])];
		cout << ans_x[I] << " " << ans_y[I] << endl;
	}

	return 0;
}
#include <bits/stdc++.h>          
using namespace std;
using ll = long long;
using ld = long double;
using matrix = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
void Cout(ll x) {cout << x << endl; exit(0);}

const ll inf = 1e18;
const ll mod = 1e9 + 7;

matrix E = {{1,0,0},{0,1,0},{0,0,1}};

matrix op1 = {{0,1,0},{-1,0,0},{0,0,1}};
matrix op2 = {{0,-1,0},{1,0,0},{0,0,1}};
matrix op3 = {{-1,0,0},{0,1,0},{0,0,1}};
matrix op4 = {{1,0,0},{0,-1,0},{0,0,1}};

matrix pre3(ll p) {
    matrix res = op3;
    res[0][2] = 2*p;
    return res;
}

matrix pre4(ll p) {
    matrix res = op4;
    res[1][2] = 2*p;
    return res;
}

matrix times(matrix X, matrix Y) {
    ll H = X.size(), W = Y[0].size(), K = Y.size();
    matrix res(H,vector<ll>(W));
    rep(i,H) rep(j,W) {
        rep(k,K) res[i][j] += X[i][k]*Y[k][j];
    }
    return res;
}

int main() {
    ll N; cin >> N;
    vector<matrix> vec(N);
    rep(i,N) {
        ll x, y; cin >> x >> y;
        vec[i] = {{x},{y},{1}};
    }
    ll M; cin >> M;
    vector<matrix> op(M+1,E);
    repp(i,1,M+1) {
        ll com; cin >> com;
        if (com==1) op[i] = times(op1,op[i-1]);
        else if (com==2) op[i] = times(op2,op[i-1]);
        else {
            ll p; cin >> p;
            matrix opt;
            if (com==3) opt = pre3(p);
            else opt = pre4(p);
            op[i] = times(opt,op[i-1]);
        }
    }
    ll Q; cin >> Q;
    vector<ll> X(Q), Y(Q);
    rep(i,Q) {
        ll a, b; cin >> a >> b;
        b--;
        matrix tmp = times(op[a],vec[b]);
        X[i] = tmp[0][0];
        Y[i] = tmp[1][0];
    }
    rep(i,Q) cout << X[i] << " " << Y[i] << endl;
}