#include <cstdio>
#include <algorithm>
#define int long long
const int N = 200005;
int n, x[N], y[N], o[N], pp[N], p, qth, q, m;
struct ABC{
    int k, co, b;
}dx, dy;
struct AandB{
    int A, B, id;
}qu[N];
struct Anss{
    int x, y, id;
}ans[N];
bool cmp(AandB x, AandB y){ return x.A < y.A; }
bool cmp2(Anss x, Anss y){ return x.id < y.id; }
signed main() {
    scanf("%lld", &n);
    for(int i = 1; i <= n; i++)
        scanf("%lld%lld", &x[i], &y[i]);
    scanf("%lld", &m);
    for(int i = 1; i <= m; i++){
        scanf("%lld", &o[i]);
        if(o[i] >= 3) scanf("%lld", &pp[i]);
    }
    scanf("%lld", &q);
    for(int i = 1; i <= q; i++){
        scanf("%lld%lld", &qu[i].A, &qu[i].B);
        qu[i].id = i;
    }
    std::sort(qu+1, qu+1+q, cmp);
    qth = 1;
    while(qth <= q && qu[qth].A == 0){
        ans[qth].x = x[qu[qth].B], ans[qth].y = y[qu[qth].B];
        ans[qth].id = qu[qth].id;
        qth++;
    }
    dx.co = 0, dx.k = 1;
    dy.co = 1, dy.k = 1;
    ABC temp = dx;
    for(int i = 1; i <= m; i++){
        int op = o[i];
        if(op == 1){
            temp = dx; dx = dy; dy = temp;
            dy.k = -dy.k; dy.b = -dy.b;
        }
        else if(op == 2){
            temp = dx; dx = dy; dy = temp;
            dx.k = -dx.k; dx.b = -dx.b;
        }
        else if(op == 3){
            p = pp[i];
            dx.k = -dx.k; dx.b = -dx.b;
            dx.b += 2*p; 
        }
        else if(op == 4){
            p = pp[i];
            dy.k = -dy.k; dy.b = -dy.b;
            dy.b += 2*p;
        }   
        while(qth <= q && qu[qth].A == i){
            if(dx.co == 0) ans[qth].x = x[qu[qth].B], ans[qth].y = y[qu[qth].B];
            else ans[qth].x = y[qu[qth].B], ans[qth].y = x[qu[qth].B];
            ans[qth].x = ans[qth].x * dx.k + dx.b;
            ans[qth].y = ans[qth].y * dy.k + dy.b;
            ans[qth].id = qu[qth].id;
            qth++;
        }
//       printf("%d %d %d | %d %d %d\n", dx.co, dx.k, dx.b, dy.co, dy.k, dy.b);
    }
    std::sort(ans+1, ans+1+q, cmp2);
    for(int i = 1; i <= q; i++)
        printf("%lld %lld\n", ans[i].x, ans[i].y);
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
int n,x[N],y[N],m,q; 
ll fx[N],fy[N],px[N],py[N];
int jg[N];
int main(){
	scanf("%d",&n);for(int i=1;i<=n;i++) scanf("%d%d",&x[i],&y[i]);
	scanf("%d",&m);
	fx[0]=fy[0]=1;
	for(int i=1;i<=m;i++){
		fx[i]=fx[i-1],fy[i]=fy[i-1],px[i]=px[i-1],py[i]=py[i-1],jg[i]=jg[i-1];
		int op,p;scanf("%d",&op);
		if(op>2) scanf("%d",&p);
		else swap(fx[i],fy[i]),swap(px[i],py[i]),jg[i]^=1;
		if(op==1) fy[i]=-fy[i],py[i]=-py[i];
		else if(op==2) fx[i]=-fx[i],px[i]=-px[i];
		else if(op==3) fx[i]=-fx[i],px[i]=2*p-px[i];
		else fy[i]=-fy[i],py[i]=2*p-py[i]; 	
	} 
	scanf("%d",&q);while(q--){
		int a,b;scanf("%d%d",&a,&b);
		if(!jg[a]) printf("%lld %lld\n",fx[a]*x[b]+px[a],fy[a]*y[b]+py[a]);
		else printf("%lld %lld\n",fx[a]*y[b]+px[a],fy[a]*x[b]+py[a]);
	}
	return 0;
}