#include <bits/stdc++.h>
#define int long long
#define PI pair<int,int>
using namespace std;
const int maxm=2e6+5;
struct Mat{
    int a[3][3];
    void init(){
        memset(a,0,sizeof a);
    }
    Mat operator*(const Mat& x){
        Mat ans;ans.init();
        for(int k=0;k<3;k++){
            for(int i=0;i<3;i++){
                for(int j=0;j<3;j++){
                    ans.a[i][j]+=a[i][k]*x.a[k][j];
                }
            }
        }
        return ans;
    }
};
int x[maxm],y[maxm];
Mat T[maxm];
int n,m,q;
void solve(){
    cin>>n;
    for(int i=1;i<=n;i++)cin>>x[i]>>y[i];
    cin>>m;
    T[0]={1,0,0,0,1,0,0,0,1};//T[0]是单位矩阵
    for(int i=1;i<=m;i++){
        int op;cin>>op;
        Mat t;
        if(op==1){//顺时针旋转90度
            t={0,1,0,-1,0,0,0,0,1};
        }else if(op==2){//逆时针旋转90度
            t={0,-1,0,1,0,0,0,0,1};
        }else if(op==3){//关于x=p对称
            int p;cin>>p;
            t={-1,0,2*p,0,1,0,0,0,1};
        }else if(op==4){//关于y=p对称
            int p;cin>>p;
            t={1,0,0,0,-1,2*p,0,0,1};
        }
        T[i]=t*T[i-1];
    }
    cin>>q;
    for(int i=1;i<=q;i++){
        int a,b;cin>>a>>b;
        Mat t={x[b],0,0,y[b],0,0,1,0,0};
        t=T[a]*t;
        cout<<t.a[0][0]<<' '<<t.a[1][0]<<endl;
    }
}
signed main(){
    ios::sync_with_stdio(0);
    solve();
    return 0;
}
/*
1.顺时针旋转90度:
(x,y)->(y,-x)

2.逆时针旋转90度:
(x,y)->(-y,x)

3.关于x=p对称:
(x,y)->(2p-x,y)

4.关于y=p对称:
(x,y)->(x,2p-y)



*/

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

P op1(P v) {
  return make_pair(v.second, -v.first);
}

P op2(P v) {
  return make_pair(-v.second, v.first);
}

P op3(P v, ll p) {
  return make_pair(2 * p - v.first, v.second);
}
 
P op4(P v, ll p) {
  return make_pair(v.first, 2 * p - v.second);
}

int main() {
  int N;
  cin >> N;

  vector<ll> X(N), Y(N);
  rep(i, N) cin >> X[i] >> Y[i];

  int M;
  cin >> M;
  vector<vector<P> > transformed(M + 1, vector<P>(3));
  transformed[0][0] = make_pair(0, 0);
  transformed[0][1] = make_pair(1, 0);
  transformed[0][2] = make_pair(0, 1);

  rep(i, M) {
    int op;
    cin >> op;
    if (op == 1) {
      transformed[i + 1][0] = op1(transformed[i][0]);
      transformed[i + 1][1] = op1(transformed[i][1]);
      transformed[i + 1][2] = op1(transformed[i][2]);
    } else if (op == 2) {
      transformed[i + 1][0] = op2(transformed[i][0]);
      transformed[i + 1][1] = op2(transformed[i][1]);
      transformed[i + 1][2] = op2(transformed[i][2]);
    } else {
      ll p;
      cin >> p;
      if (op == 3) {
        transformed[i + 1][0] = op3(transformed[i][0], p);
        transformed[i + 1][1] = op3(transformed[i][1], p);
        transformed[i + 1][2] = op3(transformed[i][2], p);
      } else if (op == 4) {
        transformed[i + 1][0] = op4(transformed[i][0], p);
        transformed[i + 1][1] = op4(transformed[i][1], p);
        transformed[i + 1][2] = op4(transformed[i][2], p);
      }
    }
  }

  int Q;
  cin >> Q;
  rep(i, Q) {
    int A, B;
    cin >> A >> B;
    cout << X[B - 1] * (transformed[A][1].first - transformed[A][0].first) + Y[B - 1] * (transformed[A][2].first - transformed[A][0].first) + transformed[A][0].first << ' ' << X[B - 1] * (transformed[A][1].second - transformed[A][0].second) + Y[B - 1] * (transformed[A][2].second - transformed[A][0].second) + transformed[A][0].second << endl; 
  }

  return 0;
}