#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxN = 2e5+10;
int X[maxN],Y[maxN];
struct node
{
    int k1,b1,k2,b2;
    bool swap;
    node(){k1=k2=1;b1=b2=0;swap=false;}
    node(int a,int b,int c,int d,bool e){k1=a,b1=b,k2=c,b2=d,swap=e;}
    node clockwise()
    {
        if(!swap)return node(-k1,-b1,k2,b2,!swap);
        return node(k1,b1,-k2,-b2,!swap);
    }
    node counterclockwise()
    {
        if(!swap)return node(k1,b1,-k2,-b2,!swap);
        return node(-k1,-b1,k2,b2,!swap);
    }
    node X_symmetric(int p)
    {
        if(!swap)return node(-k1,2*p-b1,k2,b2,swap);
        return node(k1,b1,-k2,2*p-b2,swap);
    }
    node Y_symmetric(int p)
    {
        if(!swap)return node(k1,b1,-k2,2*p-b2,swap);
        return node(-k1,2*p-b1,k2,b2,swap);
    }
}op[maxN];
signed main()
{
    int N,M,Q;
    cin>>N;
    for(int i=1;i<=N;i++)cin>>X[i]>>Y[i];
    cin>>M;
    for(int i=1;i<=M;i++)
    {
        int c;
        cin>>c;
        if(c==1)op[i]=op[i-1].clockwise();
        else if(c==2)op[i]=op[i-1].counterclockwise();
        else
        {
            int val;
            cin>>val;
            if(c==3)op[i]=op[i-1].X_symmetric(val);
            else if(c==4)op[i]=op[i-1].Y_symmetric(val);
        }
    }
    cin>>Q;
    for(int i=1;i<=Q;i++)
    {
        int A,B;
        cin>>A>>B;
        int x=op[A].k1*X[B]+op[A].b1;
        int y=op[A].k2*Y[B]+op[A].b2;
        if(op[A].swap)swap(x,y);
        cout<<x<<" "<<y<<endl;
    }
}
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << '\n'; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

#include <array>

using m = array<ll, 3>;
using matrix = array<m, 3>;

matrix calc(matrix a, matrix b) {
    matrix res = {m{0, 0, 0}, m{0, 0, 0}, m{0, 0, 0}};
    rep(i, 0, 3) {
        rep(j, 0, 3) {
            rep(k, 0, 3) {
                res[i][j] += a[i][k] * b[k][j];
            }
        }
    }
    return res;
}

matrix q2() {
    return {m{0, -1, 0}, m{1, 0, 0}, m{0, 0, 1}};
}

matrix q1() {
    return {m{0, 1, 0}, m{-1, 0, 0}, m{0, 0, 1}};
}

matrix q3(ll q) {
    return {m{-1, 0, 2 * q}, m{0, 1, 0}, m{0, 0, 1}};
}

matrix q4(ll q) {
    return {m{1, 0, 0}, m{0, -1, 2 * q}, m{0, 0, 1}};
}

matrix init() {
    return {m{1, 0, 0}, m{0, 1, 0}, m{0, 0, 1}};
}

P solve(matrix mat, P p) {
    return P{mat[0][0] * p.first + mat[0][1] * p.second + mat[0][2], mat[1][0] * p.first + mat[1][1] * p.second + mat[1][2]};
}

void print(matrix m) {
    rep(i, 0, 3) {
        rep(j, 0, 3) {
            cout << m[i][j] << ",";
        }
        cout << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    vector<ll> x(n), y(n);
    rep(i, 0, n) {
        cin, x[i], y[i];
    }
    int m;
    cin, m;
    vector<P> op(m);
    rep(i, 0, m) {
        ll a, b = -1;
        cin, a;
        if (a == 3 || a == 4) {
            cin, b;
        }
        op[i] = P(a, b);
    }
    int q;
    cin, q;
    vector<vector<P>> query(m + 1);
    // index, b
    rep(i, 0, q) {
        int a, b;
        cin, a, b;
        query[a].emplace_back(i, b);
    }
    vector<P> ans(q, P(0, 0));
    matrix mat = init();
    rep(i, 0, m + 1) {
        for (auto [idx, b] : query[i]) {
            ans[idx] = solve(mat, P(x[b - 1], y[b - 1]));
        }
        if (i != m) {
            matrix qmat = init();
            if (op[i].first == 1) {
                qmat = q1();
            } else if (op[i].first == 2) {
                qmat = q2();
            } else if (op[i].first == 3) {
                qmat = q3(op[i].second);
            } else if (op[i].first == 4) {
                qmat = q4(op[i].second);
            }
            mat = calc(qmat, mat);
        }
    }
    for (auto [X, Y] : ans) {
        print(X, Y);
    }
    return 0;
}
