#include<bits/stdc++.h>
using namespace std;

int main(){
  long long int N;
  cin >> N;
  vector<vector<long long int>> vec(N,vector<long long int>(2));
  for(int i=0;i<N;i++) cin >> vec[i][0] >> vec[i][1];
  long long int M;
  cin >> M;
  vector<vector<vector<long long int>>> OP(M+1,vector<vector<long long int>>(2,vector<long long int>(3,0)));
  OP[0][0][0] = 1;
  OP[0][1][1] = 1;
  for(int i=0;i<M;i++){
    int op;
    cin >> op;
    if(op == 1){
      OP[i+1][0][0] = OP[i][1][0];
      OP[i+1][0][1] = OP[i][1][1];
      OP[i+1][0][2] = OP[i][1][2];
      OP[i+1][1][0] = -OP[i][0][0];
      OP[i+1][1][1] = -OP[i][0][1];
      OP[i+1][1][2] = -OP[i][0][2];
    }
    if(op == 2){
      OP[i+1][0][0] = -OP[i][1][0];
      OP[i+1][0][1] = -OP[i][1][1];
      OP[i+1][0][2] = -OP[i][1][2];
      OP[i+1][1][0] = OP[i][0][0];
      OP[i+1][1][1] = OP[i][0][1];
      OP[i+1][1][2] = OP[i][0][2];
    }
    if(op == 3){
      long long int p;
      cin >> p;
      OP[i+1][0][0] = -OP[i][0][0];
      OP[i+1][0][1] = -OP[i][0][1];
      OP[i+1][0][2] = 2*p-OP[i][0][2];
      OP[i+1][1][0] = OP[i][1][0];
      OP[i+1][1][1] = OP[i][1][1];
      OP[i+1][1][2] = OP[i][1][2];
    }
    if(op == 4){
      long long int p;
      cin >> p;
      OP[i+1][0][0] = OP[i][0][0];
      OP[i+1][0][1] = OP[i][0][1];
      OP[i+1][0][2] = OP[i][0][2];
      OP[i+1][1][0] = -OP[i][1][0];
      OP[i+1][1][1] = -OP[i][1][1];
      OP[i+1][1][2] = 2*p-OP[i][1][2];
    }
  }
  long long int Q;
  cin >> Q;
  for(int i=0;i<Q;i++){
    int A,B;
    cin >> A >> B;
    long long int x=vec[B-1][0],y=vec[B-1][1];
    long long int X=0,Y=0;
    X += OP[A][0][0]*x+OP[A][0][1]*y+OP[A][0][2];
    Y += OP[A][1][0]*x+OP[A][1][1]*y+OP[A][1][2];
    cout << X << " " << Y << endl;
  }
}
#include "bits/stdc++.h"
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,mmx,avx,avx2")
using namespace std;
using ll = long long;

void A()
{
    string s; cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) cout << "Won\n";
    else cout << "Lost\n";
}

void B()
{
    int n, limit; cin >> n >> limit;
    limit *= 100;
    for (int i = 1; i <= n; ++i) {
        int vol, percent; cin >> vol >> percent;
        limit -= vol*percent;
        if (limit < 0) {cout << i; return;}
    }
    cout << -1;
}

void C()
{
    int n; cin >> n;
    int a[n];
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        int mn = a[i];
        for (int j = i; j >= 0; --j) {
            if (a[j] < mn) mn = a[j];
            ans = max(ans, 1LL*mn*(i-j+1));
        }
    }
    cout << ans;
}

void D()
{
    int n; cin >> n;
    vector<string> v(n);
    vector<array<ll, 2>> dp(n+1);
    dp[0][0] = dp[0][1] = 1;
    for (int i = 1; i <= n; ++i) {
        cin >> v[i-1];
        if (v[i-1] == "OR") {
            dp[i][1] = dp[i-1][0] + 2*dp[i-1][1];
            dp[i][0] = dp[i-1][0];
        }
        else {
            dp[i][1] = dp[i-1][1];
            dp[i][0] = dp[i-1][1] + 2*dp[i-1][0];
        }
    }
    cout << dp[n][1];
}

void E()
{
    int n; cin >> n;
    vector<array<ll, 2>> pts(n);
    for (auto &[x, y] : pts)
        cin >> x >> y;
    int m; cin >> m;
    using row = array<ll, 3>;
    using matrix = array<row, 3>;
    vector<matrix> mat(m+1);
    mat[0][0][0] = mat[0][1][1] = mat[0][2][2] = 1;
    auto matmul = [&] (auto &a, auto &b) {
        array<array<ll, 3>, 3> res = array<array<ll, 3>, 3>();
        for (int i = 0; i < 3; ++i)
            for (int j = 0; j < 3; ++j)
                for (int k = 0; k < 3; ++k)
                    res[i][j] += a[i][k] * b[k][j];
        return res;
    };
    for (int i = 1; i <= m; ++i) {
        int type; cin >> type;
        if (type == 1) {
            mat[i] = matrix{row{0, 1, 0}, row{-1, 0, 0}, row{0, 0, 1}};
        }
        else if (type == 2) {
            mat[i] = matrix{row{0, -1, 0}, row{1, 0, 0}, row{0, 0, 1}};
        }
        else {
            int p; cin >> p;
            if (type == 3) {
                mat[i] = matrix{row{-1, 0, 2*p}, row{0, 1, 0}, row{0, 0, 1}};
            }
            else {
                mat[i] = matrix{row{1, 0, 0}, row{0, -1, 2*p}, row{0, 0, 1}};
            }
        }
        mat[i] = matmul(mat[i], mat[i-1]);
    }

    int q; cin >> q;
    while (q--) {
        int a, b; cin >> a >> b;
        auto [x, y] = pts[b-1];
        auto transform = mat[a];
        cout << x*transform[0][0] + y*transform[0][1] + transform[0][2] << ' ' << x*transform[1][0] + y*transform[1][1] + transform[1][2] << '\n';
    }
}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
    E();
}