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

const int MAX_N = 2e5+2;
int n;
pair<ll,ll> p[MAX_N];
int m;
ll t[MAX_N],axis[MAX_N];
int q;
ll A[MAX_N], B[MAX_N];
pair<ll,ll> ans[MAX_N];

struct query
{
    ll a, b, id;
    bool operator<(const query& other) const
    {
        return a < other.a;    
    }
};

void solve()
{
	vector<query> Q;
	for(int i=0;i<q;++i)Q.emplace_back(query{A[i],B[i],i});
	sort(Q.begin(),Q.end());
	ll sw=0,sx=1,sy=1;
	ll cx=0,cy=0;
	int idx=1;
	for(int i=0;i<q;++i){
		for(; idx<=m && idx<=Q[i].a; ++idx){
			if(t[idx]==1){
				sw ^= 1;
				swap(cx,cy), swap(sx,sy);
				cy*=-1,sy*=-1;
			}else if(t[idx]==2){
				sw ^= 1;
				swap(cx,cy), swap(sx,sy);
				cx*=-1,sx*=-1;
			}else if(t[idx]==3){
				sx*=-1,cx*=-1;
				cx+=2LL*axis[idx];
			}else{
				sy*=-1,cy*=-1;
				cy+=2LL*axis[idx];
			}
		}
		if(!sw){
		    ans[Q[i].id].first =sx*p[Q[i].b].first+cx;
		    ans[Q[i].id].second=sy*p[Q[i].b].second+cy;
		}
		else{
		    ans[Q[i].id].first=sx*p[Q[i].b].second+cx;
		    ans[Q[i].id].second=sy*p[Q[i].b].first+cy;
		}
	}
	for(int i=0;i<q;++i)cout<<ans[i].first<<' '<<ans[i].second<<'\n';
}

int main()
{
  	ios::sync_with_stdio(false);
  	cin.tie(nullptr);
    cout.tie(nullptr);
	cin >> n;
	for(int i=1;i<=n;++i)cin>>p[i].first>>p[i].second;
	cin >> m;
	for(int i=1;i<=m;++i){
		cin >> t[i];
		if(t[i]==3 || t[i]==4) cin>>axis[i];
	}
	cin >> q;
	for(int i=0;i<q;++i)cin>>A[i]>>B[i];
	solve();
	return 0;
}
#include <bits/stdc++.h>
#define rep(i, n)	for(ll i=0;i<(ll)(n);i++)
#define ALL(a)	(a).begin(),(a).end()
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;

void op2(ll& x,ll& y){
    y*=(-1);
    ll tmp=x;
    x=y; y=tmp;
    return ;
}
void op1(ll& x,ll& y){
    x*=(-1);
    ll tmp=x;
    x=y; y=tmp;
    return ;
}
void op3(ll& x,ll& y,ll p){
    x=2*p-x;
    return ;
}
void op4(ll& x,ll& y,ll p){
    y=2*p-y;
    return ;
}

int main(){
    ll n;
    cin>>n;
    vector<P> xy(n);
    rep(i,n) cin>>xy[i].first>>xy[i].second;
    ll m;
    cin>>m;
    vector<vector<P>> c(3);
    c[0].push_back(P(0,0));
    c[1].push_back(P(1,0));
    c[2].push_back(P(0,1));
    rep(i,m){
        ll op;
        cin>>op;
        vector<ll> x(3),y(3);
        rep(j,3){
            x[j]=c[j][i].first;
            y[j]=c[j][i].second;
            //cout<<x[j]<<" "<<y[j]<<endl;
        }
        if(op==3||op==4){
            ll t;
            cin>>t;
            if(op==3){
                rep(k,3){
                    op3(x[k],y[k],t);
                    c[k].push_back(P(x[k],y[k]));
                }
            }
            else{
                rep(k,3){
                    op4(x[k],y[k],t);
                    c[k].push_back(P(x[k],y[k]));
                }
            }
        }
        else{
            if(op==1){
                rep(k,3){
                    op1(x[k],y[k]);
                    c[k].push_back(P(x[k],y[k]));
                }
            }
            else{
                rep(k,3){
                    op2(x[k],y[k]);
                    c[k].push_back(P(x[k],y[k]));
                }
            }
        }
    }
    vector<P> ans;
    ll q;
    cin>>q;
    rep(i,q){
        ll a,b;
        cin>>a>>b;
        b--;
        ll nx=c[0][a].first, ny=c[0][a].second;
        nx+=xy[b].first*(c[1][a].first-c[0][a].first);
        nx+=xy[b].second*(c[2][a].first-c[0][a].first);
        ny+=xy[b].first*(c[1][a].second-c[0][a].second);
        ny+=xy[b].second*(c[2][a].second-c[0][a].second);
        ans.push_back(P(nx,ny));
    }
    for(auto p:ans) cout<<p.first<<" "<<p.second<<endl;
}