#include <bits/stdc++.h>

using namespace std;

using ll = int64_t;

vector<vector<ll>> prod_mat(vector<vector<ll>> a1, vector<vector<ll>> a2){
    vector<vector<ll>> m(3, vector<ll>(3));
    for(int i=0; i<3; ++i){
        for(int j=0; j<3; ++j){
            for(int k=0; k<3; ++k){
                m[i][j] += a1[i][k] * a2[k][j];
            }
        }
    }

    return m;
}

vector<ll> prod_vec(vector<vector<ll>> a1, vector<ll> vec){
    vector<ll> ret(3, 0);
    for(int i=0; i<3; ++i){
        for(int j=0; j<3; ++j){
            ret[i] += a1[i][j] * vec[j];
        }
    }

    return ret;
}


int main(){
    ll N;
    cin >> N;
    vector<ll> X(N), Y(N);
    for(int i=0; i<N; ++i) cin >> X[i] >> Y[i];

    ll M;
    cin >> M;
    vector<int> op;
    map<int, ll> cood;
    for(int i=0; i<M; ++i){
        int o;
        cin >> o;
        op.push_back(o);
        if(o >= 3){
            cin >> o;
            cood[i] = o;
        }
    }

    int Q;
    cin >> Q;
    vector<ll> A(Q), B(Q);
    for(int i=0; i<Q; ++i) cin >> A[i] >> B[i];

    vector<vector<vector<ll>>> stat_matrix(M+1, vector<vector<ll>>(3, vector<ll>(3)));
    stat_matrix[0] = {{1,0,0},{0,1,0},{0,0,1}};

    for(int i=1; i<M+1; ++i){
        vector<vector<ll>> matrix_step(3, vector<ll>(3));
        if(op[i-1] == 1)
            matrix_step = {{0,1,0},{-1,0,0},{0,0,1}};
        else if(op[i-1] == 2)
            matrix_step = {{0,-1,0},{1,0,0},{0,0,1}};
        else if(op[i-1] == 3){
            ll p = cood[i-1];
            matrix_step = {{-1,0,p*2},{0,1,0},{0,0,1}};
        } else {
            ll p = cood[i-1];
            matrix_step = {{1,0,0},{0,-1,p*2},{0,0,1}};
        }
        stat_matrix[i] = prod_mat(matrix_step, stat_matrix[i-1]);
    }

    for(int i=0; i<Q; ++i){
        vector<ll> v = {X[B[i]-1], Y[B[i]-1], 1};
        vector<ll> ans = prod_vec(stat_matrix[A[i]], v);
        cout << ans[0] << " " << ans[1] << endl;
    }


    return 0;
}

#include <bits/stdc++.h>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define PB push_back
#define MP make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pdd pair<ld, ld>
#define ft first
#define sd second
#define i2 array<int,2>
#define i3 array<int,3>
#define i6 array<int,6>
#define i4 array<int,4>
#define l2 array<ll,2>
#define l3 array<ll,3>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
template<class T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const int N = 200100;
const int M = 300100;
const int BIG = int(5e8) + 10;
const int oo = 2e9;
const ll OO = 1e18;
const int md = int(1e9) + 7;
const int PW = 60;
const ld E = 1e-9;
const int MX = 1000100;
vector<l2> qr[N];
l2 ans[N];
ll n, x[N], y[N], op[N], P[N], q, m, ad[2], TP, sgn[2];

mt19937 rnd(chrono::system_clock().now().time_since_epoch().count());

void BAD(){
    cout << -1;
    exit(0);
}

int mult(int x, int y) { return (1ll * x * y) % md; }

int sum(int x, int y){
    x += y;
    if (x >= md)
        x -= md;
    return x;
}

int main(){
#ifdef _LOCAL
    freopen("in.txt","r",stdin); // freopen("output.txt","w",stdout);
#else
//    freopen("mining.in","r",stdin); freopen("mining.out","w",stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif

    cin >> n;

    for (int i = 1; i <= n; i++)
        cin >> x[i] >> y[i];

    cin >> m;

    for (int i = 1; i <= m; i++){
        cin >> op[i];

        if (op[i] > 2)
            cin >> P[i];
    }

    cin >> q;

    // sgn == 0 -- + else -
    // TP == 0 (X;Y) else (Y;X)

    for (int i = 1; i <= q; i++){
        int A, B; cin >> A >> B;

        qr[A].PB({B, i});
    }

    for (int i = 0; i <= m; i++){
        if (i > 0){
            if (op[i] == 1){
                TP ^= 1;
                swap(sgn[0], sgn[1]);
                swap(ad[0], ad[1]);

                sgn[1] ^= 1;
                ad[1] = -ad[1];
            } else if (op[i] == 2){
                TP ^= 1;
                swap(sgn[0], sgn[1]);
                swap(ad[0], ad[1]);

                sgn[0] ^= 1;
                ad[0] = -ad[0];
            } else if (op[i] == 4){
                sgn[1] ^= 1;
                ad[1] = -ad[1];
                ad[1] += P[i] * 2;
            } else {
                sgn[0] ^= 1;
                ad[0] = -ad[0];
                ad[0] += P[i] * 2;
            }
        }

        for (l2 cr : qr[i]){
            l2 res = {x[cr[0]], y[cr[0]]};

            if (TP) swap(res[0], res[1]);

            if (sgn[0]) res[0] = -res[0];
            if (sgn[1]) res[1] = -res[1];

            res[0] += ad[0];
            res[1] += ad[1];

            ans[cr[1]] = res;
        }
    }

    for (int i = 1; i <= q; i++)
        cout << ans[i][0] << " " << ans[i][1] << '\n';

    return 0;
}
