#include<bits/stdc++.h> 
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int64_t[2]>koma(n);
  for(auto &i:koma)cin>>i[0]>>i[1];
  int m;
  cin>>m;
  // x=opx[0]*x+opx[1]*y+opx[2],y=opy[0]*x+opy[1]*y+opy[2]
  vector<int64_t[3]>opx(m+1),opy(m+1);
  opx[0][0]=1,opx[0][1]=0,opx[0][2]=0;
  opy[0][0]=0,opy[0][1]=1,opy[0][2]=0;
  int o,p;
  for(int i=0;i<m;i++){
    cin>>o;
    if(o==1){
      opx[i+1][0]=opy[i][0],opx[i+1][1]=opy[i][1],opx[i+1][2]=opy[i][2];
      opy[i+1][0]=-opx[i][0],opy[i+1][1]=-opx[i][1],opy[i+1][2]=-opx[i][2];
    }else if(o==2){
      opx[i+1][0]=-opy[i][0],opx[i+1][1]=-opy[i][1],opx[i+1][2]=-opy[i][2];
      opy[i+1][0]=opx[i][0],opy[i+1][1]=opx[i][1],opy[i+1][2]=opx[i][2];
    }else if(o==3){
      cin>>p;
      opy[i+1][0]=opy[i][0],opy[i+1][1]=opy[i][1],opy[i+1][2]=opy[i][2];
      opx[i+1][0]=-opx[i][0],opx[i+1][1]=-opx[i][1],opx[i+1][2]=-opx[i][2]+2*p;
    }else{
      cin>>p;
      opx[i+1][0]=opx[i][0],opx[i+1][1]=opx[i][1],opx[i+1][2]=opx[i][2];
      opy[i+1][0]=-opy[i][0],opy[i+1][1]=-opy[i][1],opy[i+1][2]=-opy[i][2]+2*p;
    }
  }
  int q;
  cin>>q;
  for(int i=0,a,b;i<q;i++){
    cin>>a>>b;
    b--;
    cout<<koma[b][0]*opx[a][0]+koma[b][1]*opx[a][1]+opx[a][2]<<' '<<koma[b][0]*opy[a][0]+koma[b][1]*opy[a][1]+opy[a][2]<<'\n';
  }
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
#define rep3(i, m, n) for (int i = (m); (i) < (int)(n); i++)
#define all(x) begin(x), end(x)
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int N;
	cin >> N;
	vc<int> X(N), Y(N);
	rep (i, N) cin >> X[i] >> Y[i];

	int M;
	cin >> M;
	vc<int> o(M);
	vc<ll> p(M);
	rep (i, M) {
		cin >> o[i];
		if (o[i] == 3 || o[i] == 4) cin >> p[i];
	}

	int Q;
	cin >> Q;
	vvc<pair<int, int>> query(M);
	vc<int> A(Q), B(Q);
	vc<pair<ll, ll>> ans(Q);
	rep (i, Q) {
		cin >> A[i] >> B[i];
		A[i]--; B[i]--;
		if (A[i] == -1) {
			ans[i] = make_pair(X[B[i]], Y[B[i]]);
			continue;
		}
		query[A[i]].push_back(make_pair(B[i], i));
	}

	bool isminusx = false, isminusy = false, isswap = false;
	ll sumxp = 0, sumyp = 0;
	rep (i, M) {
		if (o[i] == 1) {
			if (isswap) {
				isswap = false;
				isminusy ^= true;
			}
			else {
				isswap = true;
				isminusx ^= true;
			}
			swap(sumxp, sumyp);
			sumyp *= -1;
		}
		else if (o[i] == 2) {
			if (isswap) {
				isswap = false;
				isminusx ^= true;
			}
			else {
				isswap = true;
				isminusy ^= true;
			}
			swap(sumxp, sumyp);
			sumxp *= -1;
		}
		else  {
			if (o[i] == 3) {
				sumxp *= -1;
				if (isswap) {
					isminusy ^= true;
				}
				else {
					isminusx ^= true;
				}
				sumxp += p[i] * 2;
			}
			else {
				sumyp *= -1;
				if (isswap) {
					isminusx ^= true;
				}
				else {
					isminusy ^= true;
				}
				sumyp += p[i] * 2;
			}
		}
		rep (j, query[i].size()) {
			int b = query[i][j].first, num = query[i][j].second;
			int ansx = X[b], ansy = Y[b];
			if (isminusx) ansx *= -1;
			if (isminusy) ansy *= -1;
			if (isswap) swap(ansx, ansy);
			ans[num] = make_pair(sumxp + ansx, sumyp + ansy);
		}
	}
	rep (i, Q) {
		cout << ans[i].first << " " << ans[i].second;
		cout << endl;
	}
}