#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf=1e9+7;
const int maxn=2e5+10;
ll co[maxn][2];

struct Matrix
{
	ll matrix[3][3];
	
	void make(int op)
	{
		memset(matrix,0,sizeof(matrix));
		matrix[2][2]=1;
		matrix[0][1]=(op==1)?1:-1;
		matrix[1][0]=(op==1)?-1:1;
	}
	void make(int op,ll p)
	{
		memset(matrix,0,sizeof(matrix));
		matrix[0][0]=(op==3)?-1:1;
		matrix[1][1]=(op==4)?-1:1;
		matrix[2][2]=1;
		matrix[op-3][2]=2*p;
		return ;
	}
	Matrix operator*(const Matrix& a)
	{
		Matrix ans;
		for (int i=0;i<3;i++)
		{
			for (int j=0;j<3;j++)
			{
				ans.matrix[i][j]=0;
				for (int k=0;k<3;k++)
					ans.matrix[i][j]+=(matrix[i][k]*a.matrix[k][j]);
			}
		}
		return ans;
	}
}mat[maxn];

int main(){
	int N,M,Q;
	scanf("%d",&N);
	for (int i=1;i<=N;i++) 
		scanf ("%lld %lld",&co[i][0],&co[i][1]);
	scanf("%d",&M);
	mat[0].matrix[0][0]=1;
	mat[0].matrix[1][1]=1;
	mat[0].matrix[2][2]=1;
	for (int i=1;i<=M;i++)
	{
		int op;
		ll p;
		scanf("%d",&op);
		if (op==3 || op==4)
		{
			scanf("%lld",&p);
			mat[i].make(op,p);
			mat[i]=mat[i]*mat[i-1];
		}
		else 
		{
			mat[i].make(op);
			mat[i]=mat[i]*mat[i-1];
		}
	}
	scanf("%d",&Q);
	for (int i=0;i<Q;i++)
	{
		ll a,b,x,y;
		scanf("%lld %lld",&a,&b);
		x=co[b][0];y=co[b][1];
		printf("%lld %lld\n",x*mat[a].matrix[0][0]+y*mat[a].matrix[0][1]+mat[a].matrix[0][2],x*mat[a].matrix[1][0]+y*mat[a].matrix[1][1]+mat[a].matrix[1][2]);
	}
	return 0;
}
#include<bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<pair<long, long>> pts(N);
    for(auto&& [x, y] : pts)cin >> x >> y;
    unsigned long M;
    cin >> M;
    vector<tuple<long, long, unsigned long, unsigned long>> co{{0, 0, 0, 1}};
    for(unsigned long i{0}, a, b; i < M; ++i){
        cin >> a;
        const auto [x, y, dx, dy]{co.back()};
        if(a == 1)co.emplace_back(y, -x, (dx + 3) & 3UL, (dy + 3) & 3UL);
        if(a == 2)co.emplace_back(-y, x, (dx + 1) & 3UL, (dy + 1) & 3UL);
        if(a == 3){
            cin >> b;
            co.emplace_back(2 * b - x, y, dx ^ ((~dx & 1UL) << 1UL), dy ^ ((~dy & 1UL) << 1UL));
        }
        if(a == 4){
            cin >> b;
            co.emplace_back(x, 2 * b - y, dx ^ ((dx & 1UL) << 1UL), dy ^ ((dy & 1UL) << 1UL));
        }
    }
    unsigned long Q;
    cin >> Q;
    for(unsigned long i{0}, a, b; i < Q; ++i){
        cin >> a >> b;
        const auto [x, y]{pts[b - 1]};
        const auto [ox, oy, dx, dy]{co[a]};
        cout << static_cast<long>(ox + (~dx & 1UL) * (dx & 2UL ? -1 : 1) * x + (~dy & 1UL) * (dy & 2UL ? -1 : 1) * y) << " " << static_cast<long>(oy + (dx & 1UL) * (dx & 2UL ? -1 : 1) * x + (dy & 1UL) * (dy & 2UL ? -1 : 1) * y) << endl;
    }
    return 0;
}
