#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <numeric>
#include <math.h>

using namespace std;

#define rep(i, n) for (long long int i = 0; i < (long long int)(n); i++)
#define irep(i, n) for (long long int i = 1; i <= (long long int)(n); i++)
#define drep(i, n, diff) for (long long int i = 0; i < (long long int)(n); i += diff)
#define mod 1000000007
#define cdeb(val) cout << #val << ":" << val << endl;
#define pdeb(val) printf("%s : %lld\n", #val, val);

typedef long long int ll;
typedef pair<ll, ll> P;

struct MATRIX {
  vector<vector<ll>> a;
  vector<ll> b;
  MATRIX(const vector<vector<ll>> & _a = {{1,0}, {0,1}},
    const vector<ll>& _b = {0,0}) : a(_a), b(_b) {}
  MATRIX operator*(const MATRIX& x) const {
    MATRIX res({{0,0},{0,0}});
    rep(i,2) {
      rep(j,2) {
        rep(k, 2) {
          res.a[i][j] += x.a[i][k]*a[k][j];
        }
      }
    }

    res.b = MATRIX(x.a)*b;
    rep(i,2) {
      res.b[i] += x.b[i];
    }
    return res;
  }

  vector<ll> operator*(const vector<ll>& x) const {
    vector<ll> res = b;
    rep(i,2) {
      rep(j,2) {
        res[i] += a[i][j]*x[j];
      }
    }
    return res;
  }
};

int main(){
  ll n;
  cin >> n;

  vector<vector<ll>> p(n, vector<ll>(2));
  rep(i,n) {
    cin >> p[i][0] >> p[i][1];
  }
  ll m;
  cin >> m;
  vector<MATRIX> d(1);
  rep(i,m) {
    ll op;
    cin >> op;
    MATRIX x;
    if (op == 1) {
      x = MATRIX({{0,1},{-1,0}});
    } else if (op == 2) {
      x = MATRIX({{0,-1},{1,0}});
    } else {
      ll p;
      cin >> p;
      if (op == 3) {
        x = MATRIX({{-1,0},{0,1}}, {2*p,0});
      } else {
        x = MATRIX({{1,0},{0,-1}}, {0,2*p});
      }
    }
    MATRIX y = d.back();
    d.push_back(y*x);
  }
  ll q;
  cin >> q;
  rep(i,q) {
    ll a, b;
    cin >> a >> b;
    b--;
    vector<ll> ans = d[a]*p[b];
    printf("%lld %lld\n", ans[0], ans[1]);
  }
  return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("Ofast")
#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
template<typename T>
using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

const bool DEBUG = 0;
const int MAXN = 200005;

int n,m,Q;
ii a[MAXN];
vector<pair<ii,int>> q;
vector<ii> eve;
ii ans[MAXN];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>n;
	forn(i,0,n) cin>>a[i].F>>a[i].S;
	cin>>m;
	forn(i,0,m)
	{
		int t; cin>>t;
		ll p=0;
		if(t>=3) cin>>p;
		eve.pb({t,p});
	}
	cin>>Q;
	forn(i,0,Q)
	{
		int a,b; cin>>a>>b; a--; b--;
		q.pb({{a,b},i});
	}
	
	sort(q.begin(), q.end(), greater<pair<ii,int>>());
	
	bool swapped=0;
	bool sign[2]{};
	ll off[2]{};
	
	while(q.back().F.F==-1)
	{
		int p=q.back().F.S, id=q.back().S;
		q.pop_back();
		ans[id]=a[p];
	}
	
	forn(i,0,m)
	{
		int t=eve[i].F; ll p=eve[i].S;
		if(t==1)
		{
			sign[swapped]^=1;
			off[swapped]*=-1;
			swapped^=1;
		}
		if(t==2)
		{
			sign[swapped^1]^=1;
			off[swapped^1]*=-1;
			swapped^=1;
		}
		if(t==3)
		{
			sign[swapped]^=1;
			off[swapped]*=-1;
			off[swapped]+=2*p;
		}
		if(t==4)
		{
			sign[swapped^1]^=1;
			off[swapped^1]*=-1;
			off[swapped^1]+=2*p;
		}
		while(q.size() && q.back().F.F==i)
		{
			int p=q.back().F.S; int id=q.back().S;
			q.pop_back();
			ii tmp;
			tmp.F=(sign[0]?-1:1)*a[p].F+off[0];
			tmp.S=(sign[1]?-1:1)*a[p].S+off[1];
			if(swapped) swap(tmp.F, tmp.S);
			ans[id]=tmp;
		}
	}
	
	forn(i,0,Q)
	{
		cout<<ans[i].F<<" "<<ans[i].S<<'\n';
	}
	
	return 0;
}
