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

#define asll unsigned long long
#define ULL unsigned long long
#define ll long long
#define LL long long
#define ld long double
#define imt long long
#define pii pair<long long,long long>
#define x first
#define fi first
#define y second
#define se second
#define psbk(x) push_back(x);
#define pb push_back
#define For(x,a,b) if(a!=b){icdc=(b-a)/abs(b-a))}else{icdc=1};for(long long x=(a);x!=(b+icdc);x+=icdc)
#define forp(x,a,b) if(b-a!=0){icdc=(b-a)/abs(b-a))}else{icdc=1};for(long long x=(a);x!=(b);x+=icdc)
#define FOR(x,n) for(long long x=0;x<(n);x++)
#define m_p make_pair
long long icdc;

#define kj <<" "<<
#define kjb <<" ";
#define dg <<","<<
#define ml <<'\n';
#define co cout<<
#define ter cout<<endl;
#define sibi cout<<"TES"<<endl;
#define tes(x) cout<<"TES"<<x<<endl;
#define kpr(a) cout<<"("<<a.x dg a.y <<")" ml
#define vvi vector< vector<long long> >

ULL M=1e9+7;
LL b,m,k,tc;
LL p,q,r,t;
LL a[100005];
string s;

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

vvi pm[200005];//prefix matrix
vvi hsl;

void show(vvi x,string s){
	co "Show" kj s ml
	FOR(i,x.size()){
		FOR(j,x[i].size()){
			co x[i][j] kjb
		}
		ter
	}
}

vvi kali(vvi a,vvi b){
	//sibi
	long long r1,c1,r2,c2;
	vvi ret;
	vector<long long> ret2;
	LL ret3;
	//show(a,"A dalem fungsi");
	//show(b,"B dalem fungsi");
	r1=a.size();
	c1=a[0].size();
	r2=b.size();
	c2=b[0].size();
	//co "rc" kj r1 kj c1 kj r2 kj c2 ml
	//tes(0);
	if(r2!=c1){
		cout<<"ERROR"<<endl;
		return ret;
	}
	//tes(1)
	for(long long i=0;i<r1;i++){
		//co "i=" kj i ml
		//tes(2)
		ret2.clear();
		for(long long j=0;j<c2;j++){//ngebug ternyata tadi i++
			//co "j=" kj j ml
			//tes(3)
			ret3=0;
			for(long long k=0;k<r2;k++){
				///co "k=" kj k ml
				//tes(4);
				ret3+=a[i][k]*b[k][j];
			}
			ret2.pb(ret3);
		}
		ret.pb(ret2);
	}
	/*
	FOR(i,ret.size()){
		FOR(j,ret[i].size()){
			co ret[i][j] kjb
		}ter
	}
	*/
	return ret;
}

pii titik[200005];

int main()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(0);
	//freopen("input.txt", "r", stdin);
 	//freopen("output.txt", "w", stdout);
	//srand(time(0));

	cin>>b;
	FOR(i,b){
		cin>>titik[i].x>>titik[i].y;
	}
	//sibi
	cin>>m;
	//sibi
	FOR(i,m){
		//sibi
		//co i ml
		cin>>p;
		//sibi
		//co "p=" kj p ml
		///sibi
		if(p<=2){
			//co "masukif" ml
			//sibi
			if(p==1){
				//sibi
				aku=kali(op1,aku);
			}
			else{
				aku=kali(op2,aku);
			}
		}
		else{
			//co "masukelse" ml
			cin>>q;
			//co "q=" kj q ml
			if(p==3){
				op3[0][2]=2*q;
				aku=kali(op3,aku);
				op3[0][2]=0;
			}
			else{
				op4[1][2]=2*q;
				aku=kali(op4,aku);
			}
		}
		//sibi
		pm[i]=aku;
		//co "pm[i]" ml
		//show(pm[i],"pm[i]");
	}
	cin>>k;
	//co "ka=" kj k ml
	FOR(i,k){
		cin>>p>>q;
		p--;
		q--;
		if(p<0){
			//co "HASIL" kjb
			co titik[q].x kj titik[q].y ml
			continue;
		}
		hsl={{titik[q].x},{titik[q].y},{1}};
		//co "tepat setelah operasi ke" kj p kj "pada titik ke " kj q kj "yaitu" kjb; kpr(titik[q]);
		hsl=kali(pm[p],hsl);
		//co "HASIL" kjb
		cout<<hsl[0][0] kj hsl[1][0] ml  
	}

	/*
	operasi nomer 1 :
	0 1
	-1 0
	operasi nomer 2 :
	0 -1
	1 0	
	operasi nomer 3 : cermin sumbu x=p
	x' = 2p-x
	y' = y
	operasi nomer 4 :
	


	*/

}
/*

*/


#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <list>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
void ex_gcd(ll a,ll b, ll& d,ll& x,ll& y){
  if(!b) {d=a;x=1;y=0;}
  else   {	ex_gcd(b,a%b,d,y,x);	y-=a/b*x;}
}
ll inv(ll a,ll n)  {
  ll d,x,y;	ex_gcd(a,n,d,x,y);
  return d==1?(x%n+n)%(n/d):-1;
}
ll gcd(ll x, ll y){
  if(y==0)return x;
  return gcd(y, x%y);
}
const int maxn = 200005;
const int mod = 998244353;

ll x[maxn], y[maxn];
ll a1[maxn], b1[maxn], a2[maxn], b2[maxn];
bool c1[maxn], c2[maxn];  

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>x[i]>>y[i];
  }
  int m;
  cin>>m;
  a1[0] = 1, b1[0] = 0, a2[0] = 1, b2[0] = 0;
  c1[0] = 0, c2[0] = 1;
  for(int i=1;i<=m;i++){
    string s;
    cin>>s;
    a1[i] = a1[i-1],b1[i] = b1[i-1], a2[i] = a2[i-1], b2[i] = b2[i-1];
    c1[i] = c1[i-1],c2[i] = c2[i-1];
    if(s[0]=='3'){
      ll tt;
      cin>>tt;
      a1[i] = -a1[i-1];
      b1[i] = 2*tt - b1[i-1];
    } else if(s[0]=='4'){
      ll tt;
      cin>>tt;
      a2[i] = -a2[i-1];
      b2[i] = 2*tt - b2[i-1];
    } else if(s[0]=='1'){
      swap(c1[i], c2[i]);
      swap(a1[i], a2[i]);
      swap(b1[i], b2[i]);
      a2[i] = -a2[i];
      b2[i] = -b2[i];
    } else {
      swap(c1[i], c2[i]);
      swap(a1[i], a2[i]);
      swap(b1[i], b2[i]);
      a1[i] = -a1[i];
      b1[i] = -b1[i];
    }
  }
  int Q;
  cin>>Q;
  while(Q--){
    int a,b;
    cin>>a>>b;
    ll tx=x[b], ty = y[b];
    if(c1[a]){
      swap(tx,ty);
    }
    ll rx = tx * a1[a] + b1[a];
    ll ry = ty * a2[a] + b2[a];
    cout<<rx<<" "<<ry<<endl;
  }
  return 0;
}