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

const long long INF = 1000000000;

typedef long long ll;

#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<ll, ll> P;
typedef pair<string, int> Psi;

ll index_max[1234567];
ll A[1234567];
ll ruiseki[1234567];
ll ruiseki_sum[1234567];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin>>n;

	vector<pair<ll,ll>> A,B;
	vector<pair<ll,pair<ll,ll>>> C;

	for(ll i=0; i<n;i++){
		ll a,b;cin>>a>>b;

		A.push_back(P(a,i));
		B.push_back(P(b,i));
	}

	sort(A.rbegin(), A.rend());
	sort(B.rbegin(), B.rend());

	C.push_back(make_pair(abs(A[0].first-A[n-1].first),P(A[0].second,A[n-1].second)));
	C.push_back(make_pair(abs(A[1].first-A[n-1].first),P(A[1].second,A[n-1].second)));
	C.push_back(make_pair(abs(A[0].first-A[n-2].first),P(A[0].second,A[n-2].second)));
	C.push_back(make_pair(abs(B[0].first-B[n-1].first),P(B[0].second,B[n-1].second)));
	C.push_back(make_pair(abs(B[1].first-B[n-1].first),P(B[1].second,B[n-1].second)));
	C.push_back(make_pair(abs(B[0].first-B[n-2].first),P(B[0].second,B[n-2].second)));

	sort(C.rbegin(), C.rend());

	if(C[0].second.first == C[1].second.first && C[0].second.second == C[1].second.second){
		cout<<C[2].first<<endl;
	}else{
		cout<<C[1].first<<endl;
	}
//
//	for(auto x: A){
//		cout<<x.second<<":"<<x.first<<" ";
//	}
//	cout<<endl;
//	for(auto x: B){
//		cout<<x.second<<":"<<x.first<<" ";
//	}
//	cout<<endl;
//	for(auto x: C){
//			cout<<x.second.first<<" "<<x.second.second<<":"<<x.first<<" ";
//	}
//	cout<<endl;

}

#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

struct LOC{

	ll x,y;
};

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

int N = 3;
int num_P;
LOC loc[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;

}



int main(){

	scanf("%d",&num_P);

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

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

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

	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[0][1] = 0;
	AX[1][0] = 0,AX[1][1] = 1;
	AX[2][2] = 1;

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

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

	int command;
	ll p;

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

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

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

		scanf("%d",&command);

		MATRIX work(N,V(N));

		switch(command){
		case 1:

			MULT = calc(A1,MULT);
			break;
		case 2:
			MULT = calc(A2,MULT);
			break;
		case 3:

			scanf("%lld",&p);
			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);

			break;

		case 4:

			scanf("%lld",&p);
			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);

			break;
		}

		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 = loc[index].x;
		ll y = loc[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("\n");
		for(int row = 0; row < 3; row++){
			for(int col = 0; col < 3; col++){

				printf(" %lld",table[count][row][col]);
			}
			printf("\n");
		}*/

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

	return 0;
}

