#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll p[225816],q[225816],r[225816],s[225816],t[225816],u[225816],x[225816],y[225816];

int main(void){
	int n,m,l,i,o,a,b;
	ll k;
	p[0] = 1ll; t[0] = 1ll;
	std::cin >> n;
	for(i=0; i<n; ++i){
		std::cin >> x[i] >> y[i];
	}
	std::cin >> m;
	for(i=0; i<m; ++i){
		std::cin >> o;
		switch(o){
			case 1:
			p[i+1] = s[i]; q[i+1] = t[i]; r[i+1] = u[i]; 
			s[i+1] = -p[i]; t[i+1] = -q[i]; u[i+1] = -r[i];
			break;

			case 2:
			p[i+1] = -s[i]; q[i+1] = -t[i]; r[i+1] = -u[i]; 
			s[i+1] = p[i]; t[i+1] = q[i]; u[i+1] = r[i];
			break;

			case 3:
			std::cin >> k;
			p[i+1] = -p[i]; q[i+1] = -q[i]; r[i+1] = k*2-r[i];
			s[i+1] = s[i]; t[i+1] = t[i]; u[i+1] = u[i];
			break;

			case 4:
			std::cin >> k;
			p[i+1] = p[i]; q[i+1] = q[i]; r[i+1] = r[i];
			s[i+1] = -s[i]; t[i+1] = -t[i]; u[i+1] = k*2-u[i];
			break;
		}
	}
	std::cin >> l;
	for(i=0; i<l; ++i){
		std::cin >> a >> b; --b;
		std::cout << (x[b]*p[a]+y[b]*q[a]+r[a]) << " " << (x[b]*s[a]+y[b]*t[a]+u[a]) << std::endl;
	}
	return 0;
}

#include <bits/stdc++.h>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
const ul mod = 1000000007;

class number {
  public:
    ll a;
    ll b;
    ll other;

    ll num(ll x, ll y) { return x * a + y * b + other; }
};
using p = pair<number, number>;

p op2(number x, number y) {
    number nx, ny;
    nx = {-y.a, -y.b, -y.other};
    ny = x;
    return make_pair(nx, ny);
}

p op1(number x, number y) {
    number nx, ny;
    nx = y;
    ny = {-x.a, -x.b, -x.other};
    return make_pair(nx, ny);
}

p op3(number x, number y, ll axis) {
    number nx;
    nx = {x.a, x.b, x.other - axis};
    nx = {-nx.a, -nx.b, -nx.other};
    nx = {nx.a, nx.b, nx.other + axis};
    return make_pair(nx, y);
}

p op4(number x, number y, ll axis) {
    number ny;
    ny = {y.a, y.b, y.other - axis};
    ny = {-ny.a, -ny.b, -ny.other};
    ny = {ny.a, ny.b, ny.other + axis};
    return make_pair(x, ny);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    vector<ll> x(n), y(n);
    rep(i, n) { cin >> x[i] >> y[i]; }
    ll m;
    cin >> m;
    vector<p> v(m + 1);
    v[0] = {{1, 0, 0}, {0, 1, 0}};
    rep(i, m) {
        number bx = v[i].first;
        number by = v[i].second;
        ll num;
        cin >> num;
        if (num <= 2) {
            if (num == 1) {
                v[i + 1] = op1(bx, by);
            } else {
                v[i + 1] = op2(bx, by);
            }
        } else {
            ll axis;
            cin >> axis;
            if (num == 3) {
                v[i + 1] = op3(bx, by, axis);
            } else {
                v[i + 1] = op4(bx, by, axis);
            }
        }
    }

    ll q;
    cin >> q;
    vector<ll> a(q), b(q);
    rep(i, q) {
        cin >> a[i] >> b[i];
        b[i]--;
    }

    rep(i, q) {
        number nx, ny;
        nx = v[a[i]].first;
        ny = v[a[i]].second;
        ll ans_x = nx.num(x[b[i]], y[b[i]]);
        ll ans_y = ny.num(x[b[i]], y[b[i]]);
        cout << ans_x << " " << ans_y << endl;
    }

    return 0;
}

