#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<int, int>;

int main() {
    ll n;
    cin >> n;
    vector<ll> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];
    int m;
    cin >> m;
    vector<ll> sousa11(m + 1), sousa12(m + 1), sousa21(m + 1), sousa22(m + 1);
    vector<ll> addx(m + 1), addy(m + 1);
    sousa11[0] = 1, sousa12[0] = 0;
    sousa21[0] = 0, sousa22[0] = 1;
    rep(i, m) {
        int op;
        cin >> op;
        int op11, op12;
        int op21, op22;
        if (op == 1) {
            op11 = 0, op12 = 1;
            op21 = -1, op22 = 0;
        } else if (op == 2) {
            op11 = 0, op12 = -1;
            op21 = 1, op22 = 0;
        } else if (op == 3) {
            op11 = -1, op12 = 0;
            op21 = 0, op22 = 1;
            int p;
            cin >> p;
            addx[i + 1] = 2 * p;
        } else if (op == 4) {
            op11 = 1, op12 = 0;
            op21 = 0, op22 = -1;
            int p;
            cin >> p;
            addy[i + 1] = 2 * p;
        }
        sousa11[i + 1] = op11 * sousa11[i] + op12 * sousa21[i];
        sousa12[i + 1] = op11 * sousa12[i] + op12 * sousa22[i];
        sousa21[i + 1] = op21 * sousa11[i] + op22 * sousa21[i];
        sousa22[i + 1] = op21 * sousa12[i] + op22 * sousa22[i];
        addx[i + 1] += op11 * addx[i] + op12 * addy[i];
        addy[i + 1] += op21 * addx[i] + op22 * addy[i];
    }

    int q;
    cin >> q;
    rep(i, q) {
        int a, b;
        cin >> a >> b;
        b--;
        ll ansx = sousa11[a] * x[b] + sousa12[a] * y[b] + addx[a];
        ll ansy = sousa21[a] * x[b] + sousa22[a] * y[b] + addy[a];
        cout << ansx << " " << ansy << endl;
    }
}
#include<bits/stdc++.h>
using namespace std;

namespace mymtx{
  array<array<int64_t,3>,3> mult(array<array<int64_t,3>,3> a, array<array<int64_t,3>,3> b){
    array<array<int64_t,3>,3> ret{{ {0,0,0}, {0,0,0}, {0,0,0} }};
    for(int64_t i=0;i<3;i++){
      for(int64_t j=0;j<3;j++){
        for(int64_t k=0;k<3;k++){
          ret[i][j] += a[i][k]*b[k][j];
        }
      }
    }
    return ret;
  }

  array<int64_t,3> mult(array<array<int64_t,3>,3> a, array<int64_t,3> b){
    array<int64_t,3> ret{0,0,0};
    for(int64_t i=0;i<3;i++){
      for(int64_t k=0;k<3;k++){
        ret[i] += a[i][k]*b[k];
      }
    }
    return ret;
  }
}

int main(){

  cin.tie(0);
  ios::sync_with_stdio(false);

  int64_t n; cin >> n;
  vector<array<int64_t,3>> x(n);
  for(int64_t i=0;i<n;i++){
    cin >> x[i][0] >> x[i][1];
    x[i][2] = 1;
  }

  int64_t m; cin >> m;
  vector<array<array<int64_t,3>,3>> mtx(m+1);
  mtx[0] = {{
    {1,0,0},
    {0,1,0},
    {0,0,1}
  }};
  for(int64_t i=1;i<=m;i++){
    int64_t op[2]={0,0};
    cin >> op[0];
    if(op[0]==1){
      array<array<int64_t,3>,3> tmp{{
        {0,1,0},
        {-1,0,0},
        {0,0,1}
      }};
      mtx[i] = mymtx::mult( tmp ,mtx[i-1]);
    }else if(op[0]==2){
      array<array<int64_t,3>,3> tmp{{
        {0,-1,0},
        {1,0,0},
        {0,0,1}
      }};
      mtx[i] = mymtx::mult( tmp ,mtx[i-1]);
    }else if(op[0]==3){ cin >> op[1];
      array<array<int64_t,3>,3> tmp{{
        {-1,0,2*op[1]},
        {0,1,0},
        {0,0,1}
      }};
      mtx[i] = mymtx::mult( tmp ,mtx[i-1]);
    }else if(op[0]==4){ cin >> op[1];
      array<array<int64_t,3>,3> tmp{{
        {1,0,0},
        {0,-1,2*op[1]},
        {0,0,1}
      }};
      mtx[i] = mymtx::mult( tmp ,mtx[i-1]);
    }
  }

  int64_t q; cin >> q;
  array<int64_t,3> ans{0,0,0};
  for(int64_t i=0,a,b;i<q;i++){
    cin >> a >> b;
    ans = mymtx::mult(mtx[a],x[b-1]);
    cout << ans[0] << " " << ans[1] << "\n";
  }

  return 0;
}