#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
#define all(a) a.begin(),a.end()
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define mp make_pair
#define F first
#define S second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define nl "\n"
const int MOD = 1e9+7;
const ld PI = 3.1415926535898;
const ll INF = LLONG_MAX;
#define N (int)2e5+5

ll base_mat[3][3];
ll mat[N][3][3];

void update(int i)
{
	for(int j=0;j<3;j++)
	{
		for(int k=0;k<3;k++)
		{
			for(int p=0;p<3;p++)
			{
				mat[i][j][k]+=base_mat[j][p]*mat[i-1][p][k];
			}
		}
	}
}

int main()
{
	ios;
	int n;
	cin>>n;
	ll p[n+1][2];
	for(int i=1;i<=n;i++)
	{
		cin>>p[i][0]>>p[i][1];
	}
	int m;
	cin>>m;
	memset(mat,0,sizeof(mat));
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			if(i==j)mat[0][i][j]=1;
		}
	}
	for(int i=1;i<=m;i++)
	{
		ll t,p;
		cin>>t;
		memset(base_mat,0,sizeof(base_mat));
		if(t==1)
		{
			base_mat[0][1]=1;
			base_mat[1][0]=-1;
			base_mat[2][2]=1;
		}
		else if(t==2)
		{
			base_mat[0][1]=-1;
			base_mat[1][0]=1;
			base_mat[2][2]=1;
		}
		else if(t==3)
		{
			cin>>p;
			base_mat[0][0]=-1;
			base_mat[0][2]=2*p;
			base_mat[1][1]=1;
			base_mat[2][2]=1;
		}
		else if(t==4)
		{
			cin>>p;
			base_mat[0][0]=1;
			base_mat[1][2]=2*p;
			base_mat[1][1]=-1;
			base_mat[2][2]=1;
		}
		update(i);
	}
	int q;
	cin>>q;
	while(q--)
	{
		int after_op,point_num;
		cin>>after_op>>point_num;
		ll x=p[point_num][0],y=p[point_num][1];
		ll ansx=mat[after_op][0][0]*x+mat[after_op][0][1]*y+mat[after_op][0][2];
		ll ansy=mat[after_op][1][0]*x+mat[after_op][1][1]*y+mat[after_op][1][2];
		cout<<ansx<<" "<<ansy<<nl;
	}
}
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 1000000000
#define common cout << "Case #" << w+1 << ": "  
#define MAXN 200000

int main()
{
    int n;
    cin >> n;
    vector<pair<lli,lli> >v(n);
    for(int i=0;i<n;i++)
        cin >> v[i].first >> v[i].second;
    vector<pair<lli,pair<lli,lli> > >xc,yc;
    lli px=0,py=0,x1=1,y1=0,x2=0,y2=1;
    int m;
    cin >> m;
    lli t,p;
    for(int i=0;i<m;i++)
    {
        cin >> t;
        if(t==1)
        {
            swap(py,px);
            swap(x1,x2);swap(y1,y2);
            py=-py;x2=-x2;y2=-y2;
        }
        else if(t==2)
        {
            swap(py,px);
            swap(x1,x2);swap(y1,y2);
            px=-px;x1=-x1;y1=-y1;
        }
        else if(t==3)
        {
            cin >> p;
            x1=-x1;y1=-y1;
            px=2*p-px;
        }
        else if(t==4)
        {
            cin >> p;
            x2=-x2;y2=-y2;
            py=2*p-py;
        }
        xc.push_back({px,{x1,y1}});
        yc.push_back({py,{x2,y2}});
    }
    int q;
    cin >> q;
    for(int i=0;i<q;i++)
    {
        int a,b;
        cin >> a >> b;
        --a;--b;
        if(a==-1)
        {
            cout << v[b].first << " " << v[b].second << endl;
            continue;
        }
        lli x=xc[a].first+xc[a].second.first*v[b].first+xc[a].second.second*v[b].second;
        lli y=yc[a].first+yc[a].second.first*v[b].first+yc[a].second.second*v[b].second;
        cout << x << " " << y << endl;
    }
}