#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007
//#define mod 998244353

//解説
//abc189_e
int N,M,Q;
int X[200005],Y[200005];
//行列
int G[200005][3][3];
//累乗積
int GA[200005][3][3];
signed main(){
    scanf("%lld",&N);
    rep(i,N)scanf("%lld %lld",&X[i],&Y[i]);
    scanf("%lld",&M);
    rep(i,M){
        rep(j,3)rep(k,3)G[i][j][k]=0;
        int op;
        scanf("%lld",&op);
        if(op==1){
            G[i][0][1]=1;
            G[i][1][0]=-1;
            G[i][2][2]=1;
        }else if(op==2){
            G[i][0][1]=-1;
            G[i][1][0]=1;
            G[i][2][2]=1;
        }else if(op==3){
            int p;
            scanf("%lld",&p);
            G[i][0][0]=-1;
            G[i][0][2]=2*p;
            G[i][1][1]=1;
            G[i][2][2]=1;
        }else{
            int p;
            scanf("%lld",&p);
            G[i][0][0]=1;
            G[i][1][1]=-1;
            G[i][1][2]=2*p;
            G[i][2][2]=1;
        }
    }
    //行列の累乗積を計算
    rep(i,M){
        rep(j,3){
            rep(k,3){
                //GA[i][j][k]を求める
                if(i==0)GA[i][j][k]=G[i][j][k];
                else{
                    int sum=0;
                    rep(m,3)sum+=G[i][j][m]*GA[i-1][m][k];
                    GA[i][j][k]=sum;
                }
            }
        }
    }
    scanf("%lld",&Q);
    rep(i,Q){
        int a,b;
        scanf("%lld %lld",&a,&b);a--;b--;
        if(a==-1){//そのまま
            printf("%lld %lld\n",X[b],Y[b]);
            continue;
        }
        int x=GA[a][0][0]*X[b]+GA[a][0][1]*Y[b]+GA[a][0][2];
        int y=GA[a][1][0]*X[b]+GA[a][1][1]*Y[b]+GA[a][1][2];
        printf("%lld %lld\n",x,y);
    }
}
/**
 * Author: Daniel
 * Created Time: 2021-04-03 10:23:06
**/

#include <bits/stdc++.h>

using namespace std;

#define F first 
#define S second
#define ER erase
#define IS insert
#define PI acos(-1)
#define PB pop_back
#define MP make_pair
#define MT make_tuple
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define lowbit(x) (x & -x)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define SOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<fixed<<setprecision(10)

typedef long long LL;
typedef vector<LL> VL;
typedef vector<int> VI;
typedef vector<bool> VB;
typedef pair<LL, LL> PLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef unsigned long long ULL;
typedef pair<double, double> PDD;
typedef vector<pair<LL, LL> > VPLL;
typedef vector<pair<int, int> > VPII;

template <typename A> using VE = vector<A>;
template <typename A> using USET = unordered_set<A>;
template <typename A> using HEAP = priority_queue<A>;
template <typename A, typename B> using PA = pair<A, B>;
template <typename A, typename B> using UMAP = unordered_map<A, B>;
template <typename A> using RHEAP = priority_queue<A, vector<A>, greater<A> >;

template <typename A> A MAX(const A &a) { return a; }
template <typename A> A MIN(const A &a) { return a; }
template <typename A> A MAX(const A *a, const A *b) { return *max_element(a, b); }
template <typename A> A MIN(const A *a, const A *b) { return *min_element(a, b); }
template <typename A, typename... B> A MAX(const A &a, const B&... b) { return max(a, MAX(b...)); }
template <typename A, typename... B> A MIN(const A &a, const B&... b) { return min(a, MIN(b...)); }
template <typename A, typename B = typename std::iterator_traits<A>::value_type> B MAX(A a, A b) { return *max_element(a, b); }
template <typename A, typename B = typename std::iterator_traits<A>::value_type> B MIN(A a, A b) { return *min_element(a, b); }

mt19937 rng((unsigned int)chrono::steady_clock::now().time_since_epoch().count());

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

// check the limitation!!!
const int N = 100010, M = 1010;



// read the question carefully!!!
int main()
{
    SOS;

    int n;
    cin >> n;
    VPLL a(n);
    for (auto &[x, y] : a) cin >> x >> y;
    int m;
    cin >> m;
    bool flag = false;
    LL sx = 1, sy = 1;
    LL cx = 0, cy = 0;
    VE<tuple<bool, LL, LL, LL, LL>> op;
    op.EB(MT(flag, sx, cx, sy, cy));
    for (int i = 0; i < m; i ++ )
    {
        int t;
        cin >> t;
        if (t == 1)
        {
            flag = !flag;
            sx = -sx;
            cx = -cx;
            swap(sx, sy);
            swap(cx, cy);
        }
        else if (t == 2)
        {
            flag = !flag;
            sy = -sy;
            cy = -cy;
            swap(sx, sy);
            swap(cx, cy);
        }
        else if (t == 3)
        {
            LL p;
            cin >> p;
            sx = -sx;
            cx = 2 * p - cx;
        }
        else if (t == 4)
        {
            LL p;
            cin >> p;
            sy = -sy;
            cy = 2 * p - cy;
        }
        else assert(false);
        op.EB(MT(flag, sx, cx, sy, cy));
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i ++ )
    {
        int c, b;
        cin >> c >> b;
        b -- ;
        LL x, y;
        auto [flag, sx, cx, sy, cy] = op[c];
        if (!flag) x = sx * a[b].F + cx, y = sy * a[b].S + cy;
        else x = sx * a[b].S + cx, y = sy * a[b].F + cy;
        cout << x << ' ' << y << '\n';
    }
    return 0;
}

// GOOD LUCK!!!
