#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <climits>

#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using ld = long double;
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using namespace std;
template<class T> struct matrix{
  matrix(int n = 0, T m = numeric_limits<T>::max()) : n(n), Mod(m), a(n, vector<T>(n)){}
  vector<T> &operator[](const int &m){ return a[m]; }
  matrix &operator*=(const matrix &b){
    vector<vector<T>> c(n, vector<T>(n));
    rep(i, n) rep(j, b.n) rep(k, n){
      c[i][j] = (c[i][j] + a[i][k] * b.a[k][j]) % Mod;
    }
    a = c;
    return *this;
  }
  matrix &operator+=(const matrix &b){
    rep(i, n) rep(j, n){
      a[i][j] += b.a[i][j];
      if(a[i][j] >= Mod) a[i][j] -= Mod;
    }
    return *this;
  }
  matrix &operator-=(const matrix &b){
    rep(i, n) rep(j, n){
      a[i][j] -= b.a[i][j];
      if(a[i][j] <= -Mod) a[i][j] += Mod;
    }
    return *this;
  }
  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 pow(ll t) const{
    matrix<T> b(n, Mod), c = *this;
    rep(i, n) b[i][i] = 1;
    while(t > 0){
      if(t & 1) b *= c;
      c *= c;
      t /= 2;
    }
    return b;
  }
  int n;
  vector<vector<T>> a;
  private:
  T Mod;
};
int main(){
  int n,m,q;
  cin >> n;
  vl x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  cin >> m;
  matrix<ll> op1(3), op2(3), op3(3), op4(3);
  op1.a = {{0,1,0}, {-1,0,0}, {0,0,1}};
  op2.a = {{0,-1,0}, {1,0,0}, {0,0,1}};
  op3.a = {{-1,0,0}, {0,1,0}, {0,0,1}};
  op4.a = {{1,0,0}, {0,-1,0}, {0,0,1}};
  vector<matrix<ll>> c(m + 1);
  c[0] = matrix<ll>(3);
  c[0].a = {{1,0,0}, {0,1,0}, {0,0,1}};
  rep(i, m){
    int t; cin >> t;
    if(t == 1) c[i + 1] = op1 * c[i];
    if(t == 2) c[i + 1] = op2 * c[i];
    if(t == 3){
      ll p; cin >> p;
      op3.a[0][2] = 2 * p;
      c[i + 1] = op3 * c[i];
    }
    if(t == 4){
      ll p; cin >> p;
      op4.a[1][2] = 2 * p;
      c[i + 1] = op4 * c[i];
    }
  }
  cin >> q;
  rep(i, q){
    int a,b;
    cin >> a >> b;
    b--;
    vl pos = {x[b], y[b], 1}, ans(3);
    rep(j, 3) rep(k, 3) ans[j] += c[a][j][k] * pos[k];
    cout << ans[0] << " " << ans[1] << endl;
  }
}
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

struct Operation
{
  int M;
  vector<vector<long long>> op;

  vector<vector<long long>> sel = {
    {0, 1, 0, -1, 0, 0, 0, 0, 1},
    {0, -1, 0, 1, 0, 0, 0, 0, 1},
    {-1, 0, 0, 0, 1, 0, 0, 0, 1},
    {1, 0, 0, 0, -1, 0, 0, 0, 1}
  };

  Operation(int m) : M(m)
  {
    op.resize(M + 1);
    for (int i = 0; i < M + 1; ++i)
    {
      op.at(i).resize(9);
    }
    op.at(0) = {1, 0, 0, 0, 1, 0, 0, 0, 1};
  }

  vector<long long> multiply(const vector<long long> &a, const vector<long long> &b) {
    vector<long long> rtn(9);
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        rtn.at(i * 3 + j) = a.at(i*3+0) * b.at(0+j) + a.at(i*3+1) * b.at(3+j) + a.at(i*3+2) * b.at(6+j);
      }
    }
    return rtn;
  }

  void update(int i, int o, int p)
  {
    if (o > 2) sel.at(o-1).at((o-2)*3-1) = 2 * p;
    op.at(i) = multiply(sel.at(o-1), op.at(i-1));
  }

  pair<long long, long long> apply(int i, pair<long long, long long> xy) {
    pair<long long, long long> rtn;
    rtn.first = op.at(i).at(0) * xy.first + op.at(i).at(1) * xy.second + op.at(i).at(2);
    rtn.second = op.at(i).at(3) * xy.first + op.at(i).at(4) * xy.second + op.at(i).at(5);
    return rtn;
  }
};
int main()
{
  int n;
  cin >> n;
  vector<pair<long long, long long>> xy(n);
  for (int i = 0; i < n; ++i)
  {
    cin >> xy.at(i).first >> xy.at(i).second;
  }

  int m;
  cin >> m;
  Operation op(m);
  for (int i = 1; i <= m; ++i)
  {
    int o, p = 0;
    cin >> o;
    if (o > 2) cin >> p;
    op.update(i, o, p);
  }

  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int a, b;
    cin >> a >> b;
    pair<long long, long long> ans = op.apply(a, xy.at(b-1));
    cout << ans.first << " " << ans.second << endl;

  }

  return 0;
}
