#include<bits/stdc++.h>
using namespace std;
using ll=long long;

vector<vector<ll>> Culc(vector<ll> x1, vector<ll> y1, vector<ll> z1, vector<ll> x2, vector<ll> y2, vector<ll> z2)
{
    vector<vector<ll>> R(3, vector<ll>(3));
    R[0][0] = x1[0] * x2[0] + x1[1] * y2[0] + x1[2] * z2[0];
    R[0][1] = x1[0] * x2[1] + x1[1] * y2[1] + x1[2] * z2[1];
    R[0][2] = x1[0] * x2[2] + x1[1] * y2[2] + x1[2] * z2[2];
    R[1][0] = y1[0] * x2[0] + y1[1] * y2[0] + y1[2] * z2[0];
    R[1][1] = y1[0] * x2[1] + y1[1] * y2[1] + y1[2] * z2[1];
    R[1][2] = y1[0] * x2[2] + y1[1] * y2[2] + y1[2] * z2[2];
    R[2][0] = z1[0] * x2[0] + z1[1] * y2[0] + z1[2] * z2[0];
    R[2][1] = z1[0] * x2[1] + z1[1] * y2[1] + z1[2] * z2[1];
    R[2][2] = z1[0] * x2[2] + z1[1] * y2[2] + z1[2] * z2[2];
    return R;
}

int main(void)
{
    ll N;
    cin >> N;
    vector<ll> X(N);
    vector<ll> Y(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> X[i] >> Y[i];
    }   
    ll M;
    cin >> M;
    vector<vector<ll>> x(M+1, vector<ll>(3));
    vector<vector<ll>> y(M+1, vector<ll>(3));
    vector<vector<ll>> z(M+1, vector<ll>(3));
    x[0] = {1, 0, 0};
    y[0] = {0, 1, 0};
    z[0] = {0, 0, 1};
    vector<ll> a(3);
    vector<ll> b(3);
    vector<ll> c(3);
    vector<vector<ll>> r(3, vector<ll>(3));
    for (ll i = 0; i < M; i++)
    {
        ll op;
        cin >> op;
        if (op == 1)
        {
            a = {0, 1, 0};
            b = {-1, 0, 0};
            c = {0, 0, 1};
            r = Culc(a, b, c, x[i], y[i], z[i]);
            x[i+1] = r[0];
            y[i+1] = r[1];
            z[i+1] = r[2];
        }
        else if (op == 2)
        {
            a = {0, -1, 0};
            b = {1, 0, 0};
            c = {0, 0, 1};
            r = Culc(a, b, c, x[i], y[i], z[i]);
            x[i+1] = r[0];
            y[i+1] = r[1];
            z[i+1] = r[2];
        }
        else if (op == 3)
        {
            ll p;
            cin >> p;
            a = {-1, 0, 2 * p};
            b = {0, 1, 0};
            c = {0, 0, 1};
            r = Culc(a, b, c, x[i], y[i], z[i]);
            x[i+1] = r[0];
            y[i+1] = r[1];
            z[i+1] = r[2];
        }
        else
        {
            ll p;
            cin >> p;
            a = {1, 0, 0};
            b = {0, -1, 2 * p};
            c = {0, 0, 1};
            r = Culc(a, b, c, x[i], y[i], z[i]);
            x[i+1] = r[0];
            y[i+1] = r[1];
            z[i+1] = r[2];
        }
    }

    ll Q;
    cin >> Q;
    vector<ll> A(Q);
    vector<ll> B(Q);
    for (ll i = 0; i < Q; i++)
    {
        cin >> A[i] >> B[i];
    }
    for (ll i = 0; i < Q; i++)
    {
        cout << x[A[i]][0] * X[B[i]-1] + x[A[i]][1] * Y[B[i]-1] + x[A[i]][2] << " " << y[A[i]][0] * X[B[i]-1] + y[A[i]][1] * Y[B[i]-1] + y[A[i]][2] << endl;
    }
}
#include <bits/stdc++.h>
#define ALL(x) std::begin(x), std::end(x)
using namespace std;

// @title 行列
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

template< class T >
struct Matrix {
  size_t H, W;
  vector< vector< T > > A;
  Matrix() {}
  Matrix(size_t n, size_t m) : H(n), W(m), A(H, vector< T >(W, 0)) {}
  Matrix(size_t n) : H(n), W(n), A(H, vector< T >(W, 0)) {};
  Matrix(const vector<vector<T>>& a) : A(a) {
      H = a.size();
      assert(H > 0);
      W = a[0].size();
  }
  size_t height() const { return H; }
  size_t width() const { return W; }
  inline const vector< T > &operator[](int k) const { return (A.at(k)); }
  inline vector< T > &operator[](int k) { return (A.at(k)); }
  static Matrix I(size_t n) {
    Matrix mat(n);
    for(int i = 0; i < n; i++) mat[i][i] = 1;
    return (mat);
  }

  Matrix &operator+=(const Matrix &B) {
    assert(H == B.H && W == B.W);
    for(int i = 0; i < H; i++)
      for(int j = 0; j < W; j++)
        (*this)[i][j] += B[i][j];
    return (*this);
  }

  Matrix &operator-=(const Matrix &B) {
    assert(H == B.H && W == B.W);
    for(int i = 0; i < H; i++)
      for(int j = 0; j < W; j++)
        (*this)[i][j] -= B[i][j];
    return (*this);
  }

  Matrix &operator*=(const Matrix &B) {
    assert(W == B.H);
    vector< vector< T > > C(H, vector< T >(B.W, 0));
    for(int i = 0; i < H; i++)
      for(int j = 0; j < B.W; j++)
        for(int k = 0; k < W; k++)
          C[i][j] += ((*this)[i][k] * B[k][j]);
    A.swap(C);
    return (*this);
  }

  Matrix &operator^=(long long k) {
    Matrix B = Matrix::I(H);
    while(k > 0) {
      if(k & 1) B *= *this;
      *this *= *this;
      k >>= 1LL;
    }
    A.swap(B.A);
    return (*this);
  }

  vector<T> operator*(const vector<T> &v) {
    assert(W == v.size());
    vector<T> ret(H, 0);
    for(int i = 0; i < H; i++)
      for(int j = 0; j < W; j++)
        ret[i] += ((*this)[i][j] * v[j]);
    return ret;
  }

  Matrix operator+(const Matrix &B) const { return (Matrix(*this) += B); }
  Matrix operator-(const Matrix &B) const { return (Matrix(*this) -= B); }
  Matrix operator*(const Matrix &B) const { return (Matrix(*this) *= B); }
  Matrix operator^(const long long k) const { return (Matrix(*this) ^= k); }

  friend ostream &operator<<(ostream &os, Matrix &p) {
    for(int i = 0; i < p.H; i++) {
      for(int j = 0; j < p.W; j++) {
        os << p[i][j] << (j + 1 == p.W ? "\n" : " ");
      }
    }
    return (os);
  }
};

using ll = long long;
using matrix = Matrix<ll>;
matrix l1({
    {0, 1, 0},
    {-1, 0, 0},
    {0, 0, 1}
});
matrix l2({
    {0, -1, 0},
    {1, 0, 0},
    {0, 0, 1}
});

struct Pos { int x, y; };
int main() {
    int n; cin >> n;
    vector<Pos> pos;
    for (int i = 0; i < n; ++i) {
        int x, y; cin >> x >> y;
        pos.push_back((Pos){x, y});
    }
    vector<matrix> mat;
    mat.push_back(matrix({
        {1, 0, 0},
        {0, 1, 0},
        {0, 0, 1}
    }));
    int m; cin >> m;
    for (int i = 0; i < m; ++i) {
        int op; cin >> op;
        int p;
        if (op >= 3) cin >> p;
        matrix &b = mat.back();
        if (op == 1) {
            mat.push_back(l1*b);
        }
        else if (op == 2) {
            mat.push_back(l2*b);
        }
        else if (op == 3) {
            matrix l3({
                {-1, 0, 2*p},
                {0, 1, 0},
                {0, 0, 1}
            });
            mat.push_back(l3*b);
        }
        else {
            matrix l4({
                {1, 0, 0},
                {0, -1, 2*p},
                {0, 0, 1}
            });
            mat.push_back(l4*b);
        }
    }
    int q; cin >> q;
    for (int i = 0; i < q; ++i) {
        int a, b; cin >> a >> b;
        Pos p = pos[b-1];
        vector<ll> l = {p.x, p.y, 1};
        vector<ll> ans = mat[a]*l;
        cout << ans[0] << " " << ans[1] << endl;
    }

    return 0;
}