#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using P = pair<i64, i64>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
constexpr int INF = 1001001001;

constexpr bool is_multiple = false;

using State = tuple<P, P, P>;

void flip_x(P &pos, i64 p) {
    i64 dx = abs(pos.first - p);

    if (pos.first > p) {
        pos.first -= 2 * dx;
    }
    else {
        pos.first += 2 * dx;
    }
}

void flip_y(P &pos, i64 p) {
    i64 dy = abs(pos.second - p);

    if (pos.second > p) {
        pos.second -= 2 * dy;
    }
    else {
        pos.second += 2 * dy;
    }
}

void print_state(State s) {
    P e0 = get<0>(s);
    P ex = get<1>(s);
    P ey = get<2>(s);

    printf("Origin: %lld %lld\n", e0.first, e0.second);
    printf("Ex: %lld %lld\n", ex.first, ex.second);
    printf("Ey: %lld %lld\n", ey.first, ey.second);
}

void solve() {
    int n;
    cin >> n;
    vector<i64> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];
    int m;
    cin >> m;
    // (0, 0), (1, 0), (0, 1)
    vector<State> states(m+1);
    states[0] = {{0, 0}, {1, 0}, {0, 1}};
    rep(i, m) {
        int t, p = -1;
        cin >> t;

        State old = states[i];
        P e0 = get<0>(old);
        P ex = get<1>(old);
        P ey = get<2>(old);

        if (t == 1) {
            e0 = {e0.second, -e0.first};
            ex = {ex.second, -ex.first};
            ey = {ey.second, -ey.first};
        }
        else if (t == 2) {
            e0 = {-e0.second, e0.first};
            ex = {-ex.second, ex.first};
            ey = {-ey.second, ey.first};
        }
        else {
            cin >> p;

            if (t == 3) {
                flip_x(e0, p);
                flip_x(ex, p);
                flip_x(ey, p);
            }
            else {
                flip_y(e0, p);
                flip_y(ex, p);
                flip_y(ey, p);
            }
        }

        states[i+1] = {e0, ex, ey};
        // print_state(states[i+1]);
    }
    int q;
    cin >> q;
    vec a(q), b(q);
    rep(i, q) {
        cin >> a[i] >> b[i];
        b[i]--;

        i64 sx = x[b[i]];
        i64 sy = y[b[i]];
        State state = states[a[i]];
        P e0 = get<0>(state);
        P ex = get<1>(state);
        P ey = get<2>(state);

        i64 gx, gy;

        gx = e0.first + (ex.first - e0.first) * sx + (ey.first - e0.first) * sy;
        gy = e0.second + (ex.second - e0.second) * sx + (ey.second - e0.second) * sy;

        printf("%lld %lld\n", gx, gy);
    }
}

int main() {
    int t = 1;
    if (is_multiple) cin >> t;
    while (t--) solve();
    return 0;
}

#include<cstdio>
#include<algorithm>
#define int long long
using namespace std;
const int N = 2e5 + 50;

struct Point{
    int x, y;
}p[N];

int n, m, Q;
int r[N], x[N], y[N], nx[N], ny[N];

signed main(){
    scanf("%lld", &n);
    for(int i = 1; i <= n; ++i)  scanf("%lld%lld", &p[i].x, &p[i].y);
    scanf("%lld", &m);
    for(int i = 1, opt; i <= m; ++i){
        scanf("%lld", &opt);
        r[i] = r[i - 1], x[i] = x[i - 1], y[i] = y[i - 1];
        nx[i] = nx[i - 1], ny[i] = ny[i - 1];
        if(opt == 1){
        	x[i] *= -1;
        	swap(x[i], y[i]);
        	if(nx[i] + ny[i] == 1)  ++r[i];
        	else  --r[i];
		}
        else if(opt == 2){
        	y[i] *= -1;
        	swap(x[i], y[i]);
        	if(nx[i] + ny[i] == 1)  --r[i];
        	else  ++r[i];
		}
        else{
            int p;
            scanf("%lld", &p);
            if(opt == 3)  x[i] = 2 * p - x[i],  nx[i] ^= 1;
            else  y[i] = 2 * p - y[i],  ny[i] ^= 1;
        }
    }
    scanf("%lld", &Q);
    while(Q--){
        int A, B;
        scanf("%lld%lld", &A, &B);
        int dx = p[B].x;
        int dy = p[B].y;
        r[A] = (r[A] % 4 + 4) % 4;
        if(r[A] == 1)  dy *= -1,  swap(dx, dy);
        else if(r[A] == 2)  dx *= -1,  dy *= -1;
        else if(r[A] == 3)  dx *= -1,  swap(dx, dy);
        if(nx[A])  dx *= -1;
        if(ny[A])  dy *= -1;
        printf("%lld %lld\n", dx + x[A], dy + y[A]);
    }
    return 0;
}