#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;

int main() {
  int N;
  cin >> N;
  vector<P> xy(N);
  rep(i,N) cin >> xy[i].first >> xy[i].second;
  
  int M;
  cin >> M;
  vector<vector<ll>> state(M+1, vector<ll>(4));//x, y, xの向き, yの向き
  state[0][3]=1;//state[0]={0,0, 0,1}
  int a, p;
  rep(i,M) {
    cin >> a;
    if(a==2) {
      state[i+1][0] = state[i][1]*(-1);
      state[i+1][1] = state[i][0];
      state[i+1][2] = (state[i][2]+1)%4;
      state[i+1][3] = (state[i][3]+1)%4;
    }
    if(a==1) {
      state[i+1][0] = state[i][1];
      state[i+1][1] = state[i][0]*(-1);
      state[i+1][2] = (state[i][2]+3)%4;
      state[i+1][3] = (state[i][3]+3)%4;
    }
    if(a==3) {
      cin >> p;
      state[i+1][0] = (ll)2*p-state[i][0];
      state[i+1][1] = state[i][1];
      if(state[i][2]%2 == 0) {
        state[i+1][2] = (state[i][2]+2)%4;
        state[i+1][3] = state[i][3];
      }
      else {
        state[i+1][2] = state[i][2];
        state[i+1][3] = (state[i][3]+2)%4;
      }
    }
    if(a==4) {
      cin >> p;
      state[i+1][0] = state[i][0];
      state[i+1][1] = (ll)2*p-state[i][1];
      if(state[i][2]%2 == 1) {
        state[i+1][2] = (state[i][2]+2)%4;
        state[i+1][3] = state[i][3];
      }
      else {
        state[i+1][2] = state[i][2];
        state[i+1][3] = (state[i][3]+2)%4;
      }
    }
    //for(auto h : state[i+1]) cout << h << " ";
    //cout << endl;
    //stateはOK
  }
  
  int Q;
  cin >> Q;
  rep(i,Q) {
    cin >> a >> p;//state[a] = {o,o,o,o} , xy[p] = {x,y}
    p--;
    if(state[a][2]==0) {//x=0
      if(state[a][3]==1) {//(0,1)
        cout << (ll)state[a][0] + xy[p].first << " " << (ll)state[a][1] + xy[p].second << endl;
      }
      else {//(0,3)
        cout << (ll)state[a][0] + xy[p].first << " " << (ll)state[a][1] - xy[p].second << endl;
      }
    }
    if(state[a][2]==1) {//x=1
      if(state[a][3]==0) {//(1,0)
        cout << (ll)state[a][0] + xy[p].second << " " << (ll)state[a][1] + xy[p].first << endl;
      }
      else {//(1,2)
        cout << (ll)state[a][0] - xy[p].second << " " << (ll)state[a][1] + xy[p].first << endl;
      }
    }
    if(state[a][2]==2) {//x=2
      if(state[a][3]==1) {//(2,1)
        cout << (ll)state[a][0] - xy[p].first << " " << (ll)state[a][1] + xy[p].second << endl;
      }
      else {//(2,3)
        cout << (ll)state[a][0] - xy[p].first << " " << (ll)state[a][1] - xy[p].second << endl;
      }
    }
    if(state[a][2]==3) {//x=3
      if(state[a][3]==0) {//(3,0)
        cout << (ll)state[a][0] + xy[p].second << " " << (ll)state[a][1] - xy[p].first << endl;
      }
      else {//(3,2)
        cout << (ll)state[a][0] - xy[p].second << " " << (ll)state[a][1] - xy[p].first << endl;
      }
    }
  }
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x1 gdsfdsf
#define y1 fgdfgdfg
#define endl '\n'
const ll DIM = 2E5+7;
pair<ll,ll> A[DIM],Q[DIM];
vector<pair<ll,ll> > V[DIM];
pair<ll,ll> ans[DIM];

pair<ll,ll> F(pair<ll,ll> a,ll rot){
    if (rot==0){
        return a;
    }
    if (rot==1){
        return {a.second,a.first};
    }
    if (rot==2){
        return {a.first,a.second};
    }
    if (rot==3){
        return {a.second,a.first};
    }
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    for(ll i = 1;i<=n;++i){
        cin>>A[i].first>>A[i].second;
    }
    ll m;
    cin>>m;
    for(ll i = 1;i<=m;++i){
        cin>>Q[i].first;
        if (Q[i].first>2)
            cin>>Q[i].second;
    }
    ll q;
    cin>>q;
    for(ll i = 1;i<=q;++i){
        ll x,y;
        cin>>x>>y;
        V[x].push_back({y,i});
    }
    for(auto to:V[0]){
        ans[to.second] = A[to.first];
    }
    ll rot = 0;
    ll addx = 0,addy = 0,multx = 1,multy = 1;
    for(ll i = 1;i<=m;++i){
        if (Q[i].first==1){
            rot = (rot+1)%4;
            swap(addx,addy);
            addy = -addy;
            swap(multx,multy);
            multy = -multy;
        }
        if (Q[i].first==2){
            rot = (3+rot)%4;
            swap(addx,addy);
            addx = -addx;
            swap(multx,multy);
            multx = -multx;
        }
        if (Q[i].first==3){
            multx = -multx;
            addx = -addx;
            addx+=Q[i].second*2;
        }
        if (Q[i].first==4){
            multy = -multy;
            addy = -addy;
            addy+=Q[i].second*2;
        }
        for(auto to:V[i]){
            pair<ll,ll> a = F(A[to.first],rot);
            a.first = a.first*multx+addx;
            a.second = a.second*multy+addy;
            ans[to.second] = a;
        }
    }

    for(ll i = 1;i<=q;++i)cout<<ans[i].first<<' '<<ans[i].second<<endl;
    return 0;
}
