#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

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

struct Info{

	ll x,y;
};

int num_P;
int N = 3;
Info info[SIZE];
ll table[SIZE][3][3];


MATRIX calc(MATRIX left,MATRIX right){

	MATRIX ret(N,V(N));

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

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

	return ret;

}

//MULTのT乗を計算する
MATRIX pow(MATRIX MULT,int count){

	MATRIX ret(N,V(N));

	for(int row = 0; row < N; row++){
		for(int col = 0; col < N; col++){
			if(row == col)ret[row][col] = 1;
			else{
				ret[row][col] = 0;
			}
		}
	}

	while(count > 0){
		if(count%2 == 1)ret = calc(ret,MULT);
		MULT = calc(MULT,MULT);
		count /= 2;
	}

	return ret;
}

int main(){

	scanf("%d",&num_P);

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

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

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

		MULT[i][i] = 1;
	}

	MATRIX A1(N,V(N));
	A1[0][1] = 1,A1[1][0] = -1,A1[2][2] = 1;

	MATRIX A2(N,V(N));
	A2[0][1] = -1,A2[1][0] = 1,A2[2][2] = 1;

	MATRIX AX(N,V(N));
	AX[0][0] = -1,AX[1][1] = 1,AX[2][2] = 1;

	MATRIX AY(N,V(N));
	AY[0][0] = 1,AY[1][1] = -1,AY[2][2] = 1;


	MATRIX work(N,V(N));

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

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

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

	int command;
	ll p;

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

		scanf("%d",&command);

		if(command == 1){

			MULT = calc(A1,MULT);
		}else if(command == 2){

			MULT = calc(A2,MULT);

		}else{

			scanf("%lld",&p);

			if(command == 3){

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

						work[row][col] = AX[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] = AY[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 Q;
	scanf("%d",&Q);

	int count,index;

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

		scanf("%d %d",&count,&index);

		ll x = info[index].x;
		ll y = info[index].y;

		ll ans_x = table[count][0][0]*x + table[count][0][1]*y + table[count][0][2];
		ll ans_y = table[count][1][0]*x + table[count][1][1]*y + table[count][1][2];

		printf("%lld %lld\n",ans_x,ans_y);
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
using ll=int64_t;
using pll=pair<ll,ll>;

struct OP{
    pll o={0,0},ex={1,0},ey={0,1};
};
pll operator+(pll a,pll b){return{a.first+b.first,a.second+b.second};}
pll operator-(pll a,pll b){return{a.first-b.first,a.second-b.second};}
pll operator*(pll a,ll b){return {a.first*b,a.second*b};}
OP operator*(const OP& a,const OP& b){
    OP ans;
    ans.o=b.o+b.ex*a.o.first+b.ey*a.o.second;
    ans.ex=b.ex*a.ex.first+b.ey*a.ex.second;
    ans.ey=b.ex*a.ey.first+b.ey*a.ey.second;
    return ans;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N;
    cin>>N;
    vector<pair<ll,ll>> point(N);
    for(auto& [X, Y] : point)cin>>X>>Y;
    ll M;
    cin>>M;
    vector<OP> op(M);
    for(OP& a:op){
        ll type;
        cin>>type;
        if(type==1){
            a.ex={0,-1};
            a.ey={1,0};
        }
        else if(type==2){
            a.ex={0,1};
            a.ey={-1,0};
        }else if(type==3){
            ll p;
            cin>>p;
            a.o={p*2,0};
            a.ex={-1,0};
        }else {
            ll p;
            cin>>p;
            a.o={0,p*2};
            a.ey={0,-1};
        }
    }
    op.insert(op.begin(),OP{});
    for(ll i=0;i<M;i++)op[i+1]=op[i]*op[i+1];
    ll Q;
    cin>>Q;
    for(ll i=0;i<Q;i++){
        ll A,B;
        cin>>A>>B;
        const auto [X, Y] =point[B-1];
        pll ans=op[A].o+op[A].ex*X+op[A].ey*Y;
        cout<<ans.first<<' '<<ans.second<<'\n';
    }
}
