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

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    int n,m,q;
    cin >> n;
    int x[n],y[n];
    for(int i=0;i<n;i++)
    	cin >> x[i] >> y[i];
    cin >> m;
    vector <pair <int,int> > op,ans;
    vector <pair <int,int> > qry[m];
    for(int i=0;i<m;i++){
    	int t,p=0;
    	cin >> t;
    	if(t>2)cin >> p;
    	op.push_back({t,p});
    }
    cin >> q;
    ans.resize(q);
    int s=0,fx=1,fy=1,dx=0,dy=0;
    for(int i=0;i<q;i++){
    	int a,b;
    	cin >> a >> b;
    	b--;
    	a--;
    	if(a==-1){
    		ans[i]={x[b],y[b]};
    		continue;
    	}
    	qry[a].push_back({b,i});
    }
    for(int i=0;i<m;i++){
    	auto [t,p]=op[i];
    	if(t==1){
    		s^=1;
    		swap(fx,fy);
    		swap(dx,dy);
    		fy=-fy;
    		dy=-dy;
    	}
    	if(t==2){
    		s^=1;
    		swap(fx,fy);
    		swap(dx,dy);
    		fx=-fx;
    		dx=-dx;
    	}
    	if(t==3){
    		fx=-fx;
    		dx=-dx;
    		dx+=2*p;
    	}
    	if(t==4){
    		fy=-fy;
    		dy=-dy;
    		dy+=2*p;
    	}
    	for(auto &[j,id]:qry[i]){
    		int tx=x[j],ty=y[j];
    		if(s)swap(tx,ty);
    		tx*=fx,ty*=fy;
    		tx+=dx,ty+=dy;
    		ans[id]={tx,ty};
    	}
    }
    for(auto [tx,ty]:ans)
    	cout << tx << ' ' << ty << '\n';
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,x,n) for(int i = x;i <= n;++i)	
typedef pair<int,int> pii;
#define x first
#define y second

const int N = 3,_N = 2e5 + 7;
struct mat
{
	ll m[N][N];
};

pii a[_N];
mat op[_N];

mat mul(mat A,mat B,int len)
{
    mat c;memset(c.m,0,sizeof c.m);
    for(ll i = 0;i < len;++i)
        for(ll j = 0;j < len;++j)
            for(ll k = 0;k < len;++k)
            {
            	c.m[i][j]=(c.m[i][j]+(A.m[i][k]*B.m[k][j]));
            }
	return c;
}
mat qpow(mat a,ll len,ll k)
{
   	mat res;memset(res.m,0,sizeof res.m);
    for(ll i = 0;i < len;++i)   res.m[i][i] = 1;
    while(k)
    {
        if(k & 1)   res = mul(res,a,len);
        a = mul(a,a,len);
        k >>= 1;
    }
    return res;
}

int main()
{
	int n;scanf("%d",&n);
	forn(i,1,n)	scanf("%d%d",&a[i].x,&a[i].y);
    int m;scanf("%d",&m);
    forn(i,1,m)
    {
    	int t;scanf("%d",&t);
    	mat _;memset(_.m,0,sizeof _.m);
    	if(t == 1)
    	{
    		_.m[0][1] = -1;_.m[1][0] = 1;_.m[2][2] = 1;
    		op[i] = mul(op[i - 1],_,3);
    	}
    	else if(t == 2)
    	{
    		_.m[0][1] = 1;_.m[1][0] = -1;_.m[2][2] = 1;
    		op[i] = mul(op[i - 1],_,3);
    	}
    	else if(t == 3)
    	{
    		int p;scanf("%d",&p);
    		_.m[0][0] = -1;_.m[1][1] = 1;_.m[2][0] = 2 * p;_.m[2][2] = 1;
    		op[i] = mul(op[i - 1],_,3);
    	}
    	else
    	{
    		int p;scanf("%d",&p);
    		_.m[0][0] = 1;_.m[1][1] = -1;_.m[2][1] = 2 * p;_.m[2][2] = 1;
    		op[i] = mul(op[i - 1],_,3);
    	}
    	if(i == 1)	op[i] = _;
    }
    int q;scanf("%d",&q);
    while(q--)
    {
    	int A,B;scanf("%d%d",&A,&B);
    	if(A == 0)	printf("%d %d\n",a[B].x,a[B].y);
    	else
    	{
    		mat gamma;memset(gamma.m,0,sizeof gamma.m);
    		gamma.m[0][0] = a[B].x,gamma.m[0][1] = a[B].y,gamma.m[0][2] = 1;
    		gamma = mul(gamma,op[A],3);
    		printf("%lld %lld\n",gamma.m[0][0],gamma.m[0][1]);
    	}
    }
    return 0;
}