#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
using vi64 = vector<i64>;
using vvi64 = vector<vi64>;
using vvvi64 = vector<vvi64>;
using u64 = uint64_t;

#define rep(i, s, n) for (i64 i = (s); i < (n); ++i)

void mul(vvi64& c, const vvi64& a, const vvi64& b) {
  rep(i, 0, 3) {
    rep(j, 0, 3) {
      rep(k, 0, 3) { c[i][j] += a[i][k] * b[k][j]; }
    }
  }
}

const vvi64 m1_of() { return {{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}}; }

const vvi64 m2_of() { return {{0, -1, 0}, {1, 0, 0}, {0, 0, 1}}; }

const vvi64 m3_of(i64 p) { return {{-1, 0, 2 * p}, {0, 1, 0}, {0, 0, 1}}; }

const vvi64 m4_of(i64 p) { return {{1, 0, 0}, {0, -1, 2 * p}, {0, 0, 1}}; }

void run() {
  i64 n;
  cin >> n;
  vi64 xs(n), ys(n);
  rep(i, 0, n) { cin >> xs[i] >> ys[i]; }
  i64 m;
  cin >> m;
  vvvi64 trs(m + 1, vvi64(3, vi64(3, 0)));
  rep(i, 0, 3) { trs[0][i][i] = 1; }
  rep(i, 1, m + 1) {
    i64 op;
    cin >> op;
    if (op == 1) {
      mul(trs[i], m1_of(), trs[i - 1]);
    } else if (op == 2) {
      mul(trs[i], m2_of(), trs[i - 1]);
    } else if (op == 3) {
      i64 p;
      cin >> p;
      mul(trs[i], m3_of(p), trs[i - 1]);
    } else if (op == 4) {
      i64 p;
      cin >> p;
      mul(trs[i], m4_of(p), trs[i - 1]);
    }
  }
  i64 q;
  cin >> q;
  rep(i, 0, q) {
    i64 a, b;
    cin >> a >> b;
    --b;
    i64 x{trs[a][0][0] * xs[b] + trs[a][0][1] * ys[b] + trs[a][0][2] * 1},
        y{trs[a][1][0] * xs[b] + trs[a][1][1] * ys[b] + trs[a][1][2] * 1};
    cout << x << " " << y << endl;
  }
}

int main() {
  cin.tie(nullptr);
  cout.precision(std::numeric_limits<double>::max_digits10);
  run();
  return 0;
}

//Never stop trying
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef long long ll;
#define int ll
typedef string str;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
//constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
ll random(ll a, ll b){
    return a + rng() % (b - a + 1);
}
#ifndef LOCAL  
#define cerr if(false) cerr
#endif
#define dbg(x) cerr << #x << " : " << x << endl; 
#define dbgs(x,y) cerr << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << #v << " : " << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;
#define here() cerr << "here" << endl;

void IO() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);
#endif
}
/////////////////////////ONLY CLEAN CODES ALLOWED/////////////////////////

const int C=1e15;

bool reasonable(int x){
	return x>=-C && x<=C;
}

int32_t main() {
    boost; IO();

    int N; cin>>N;
    vi X(N),Y(N);
    FOR(i,0,N) cin>>X[i]>>Y[i];

    int M; cin>>M;
    vpi vec;
    FOR(i,0,M){
    	int t,p=-1; cin>>t;
    	if(t>=3) cin>>p;
    	vec.eb(t,p);
    }

    int a[M],b[M],v[M],v2[M],c[M],d[M];

    int cur_a=1,cur_b=1,cur_v=0,cur_v2=1,cur_c=0,cur_d=0;
    FOR(i,0,M){
    	int t=vec[i].fi,p=vec[i].se;
    	if(t==2){
    		swap(cur_a,cur_b); 
    		swap(cur_v,cur_v2); 
    		swap(cur_c,cur_d);
    		cur_a*=-1;
    		cur_c*=-1; 
    	}
    	else if(t==1){
    		swap(cur_a,cur_b); 
    		swap(cur_v,cur_v2); 
    		swap(cur_c,cur_d);
    		cur_b*=-1;
    		cur_d*=-1; 
    	}
    	else if(t==3){
    		cur_a*=-1;
    		cur_c*=-1; 
    		cur_c+=2*p;
    	}
    	else if(t==4){
    		cur_b*=-1;
    		cur_d*=-1; 
    		cur_d+=2*p;
    	}

    	a[i]=cur_a; b[i]=cur_b;
    	v[i]=cur_v; v2[i]=cur_v2;
    	c[i]=cur_c; d[i]=cur_d;

    	/*dbg(cur_a)
    	dbg(cur_v)
    	dbg(cur_c)*/
    }

    int Q; cin>>Q;
    while(Q--){
    	int op,i; cin>>op>>i;
    	op--; i--;
    	if(op<0){
    		cout << X[i] << ' ' << Y[i] << endl;
    		continue;
    	}

    	int x=X[i],y=Y[i];

    	cur_a=a[op];
    	cur_b=b[op];
    	cur_c=c[op];
    	cur_d=d[op];

    	dbgs(cur_a,cur_b)

    	if(v[op]==0){
    		cout << cur_a*x+cur_c << ' ' << cur_b*y+cur_d << endl; 
    	}
    	else{
    		cout << y*cur_a+cur_c << ' ' << cur_b*x+cur_d << endl; 
    	}

    }


    

    return 0;
}
//Change your approach 