


#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr)
//:/
#define pb push_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265;
using ll = long long;

const ll modo=998244353;
const ll ms=2e5+5;
const ll inf=1e17;

ll ar[ms][2];
ll op[ms][2];
ll ans[ms][2];
vector<pair<ll,ll>> vv[ms];

int main()
{
    idfc;


    ll n;
    cin>>n;
    ll i;
    ll x,y;
    ll a,b;

    for(i=1;i<=n;i++)
    {
        cin>>ar[i][0]>>ar[i][1];
    }
    ll m;
    cin>>m;

    for(i=1;i<=m;i++)
    {
        cin>>op[i][0];
        if(op[i][0]>2)cin>>op[i][1];
    }

    ll q;
    cin>>q;

    for(i=1;i<=q;i++)
    {
        cin>>x>>y;
        vv[x].pb({y,i});
    }


    for(auto ii:vv[0])
    {
        ans[ii.second][0]=ar[ii.first][0];
        ans[ii.second][1]=ar[ii.first][1];
    }
    ll t;
    ll p;
    ll tot=0;


    x=0;
    y=0;
    a=0;
    b=0;
    ll tmp;
    ll t2=0;
    ll t3=0;


    for(i=1;i<=m;i++)
    {
        t=op[i][0];
        p=op[i][1];
        if(t==1)
        {
            tot=(tot+1)%2;
            if(tot)
            {
                x=-x;
                t2=(t2+1)%2;
            }
            else{
                y=-y;
                t3=(t3+1)%2;
            }
        }
        else if(t==2)
        {
            tot=(tot+1)%2;
            if(tot)
            {
                y=-y;
                t3=(t3+1)%2;
            }
            else{
                x=-x;
                t2=(t2+1)%2;
            }
        }
        else if(t==3)
        {
            if(!tot)
            {
                x=p-x;
                t2=(t2+1)%2;
            }
            else{
                y=p-y;
                t3=(t3+1)%2;
            }
        }
        else if(t==4)
        {
            if(!tot)
            {
                y=p-y;
                t3=(t3+1)%2;
            }
            else{
                x=p-x;
                t2=(t2+1)%2;
            }
        }


        for(auto it:vv[i])
        {
            ll nx,ny;
            if(t2)
            {
                nx=x+x-ar[it.first][0];
            }
            else{
                nx=x+x+ar[it.first][0];
            }
            if(t3)
            {
                ny=y+y-ar[it.first][1];
            }
            else{
                ny=y+y+ar[it.first][1];
            }
            if(tot)
            {
                ans[it.second][0]=ny;
                ans[it.second][1]=nx;
            }
            else{
                ans[it.second][0]=nx;
                ans[it.second][1]=ny;
            }
        }
    }

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



    return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

template <class T>
class Matrix {
 public:
  int h, w;
  V<V<T>> data;
  Matrix(int h_, int w_ = 0, T v = 0) {
    h = h_;
    w = (w != 0) ? w_ : h;
    data.resize(h);
    rep(i, h) data[i].resize(w, v);
  }
  Matrix(const V<V<T>>& data_)
      : h(data_.size()), w(data_[0].size), data(data_) {}
  Matrix(initializer_list<initializer_list<T>> list) {
    data.resize(list.size());
    int cnt = 0;
    for (auto row : list) data[cnt++] = V<T>(row);
    h = data.size(), w = data[0].size();
  }
  Matrix(const Matrix& a) : h(a.h), w(a.w), data(a.data) {}
  Matrix& operator=(const Matrix& a) {
    h = a.h, w = a.w, data = a.data;
    return *this;
  }
  V<T>& operator[](int n) { return data[n]; }
  Matrix& operator*=(Matrix& a) {
    V<V<T>> res(w, V<T>(a.w));
    rep(i, w) rep(j, a.w) {
      rep(k, w) res[i][j] += data[i][k] * a[k][j];
    }
    swap(data, res);
    h = w, w = a.w;
    return *this;
  }
  Matrix operator*(Matrix& a) { return Matrix(*this) *= a; }
  Matrix& operator+=(Matrix& a) {
    rep(i, h) rep(j, w) data[i][j] += a[i][j];
    return *this;
  }
  string str() {
    ostringstream oss;
    rep(i, h) {
      rep(j, w) oss << data[i][j] << " ";
      if (i != h - 1) oss << "\n";
    }
    return oss.str();
  }
};

int main() {
  int n, m;
  cin >> n;

  V<P> xy(n);
  rep(i, n) cin >> xy[i].first >> xy[i].second;

  V<Matrix<ll>> ops;
  Matrix<ll> now = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
  ops.push_back(now);
  Matrix<ll> clk = {{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}};
  Matrix<ll> clw = {{0, -1, 0}, {1, 0, 0}, {0, 0, 1}};
  Matrix<ll> f3 = {{-1, 0, 2}, {0, 1, 0}, {0, 0, 1}};
  Matrix<ll> f4 = {{1, 0, 0}, {0, -1, 2}, {0, 0, 1}};

  cin >> m;
  rep(i, m) {
    int op;
    ll p;
    cin >> op;
    if (op > 2) cin >> p;

    if (op == 1) {
      now = clk * now;
    } else if (op == 2) {
      now = clw * now;
    } else if (op == 3) {
      f3[0][2] = 2 * p;
      now = f3 * now;
    } else if (op == 4) {
      f4[1][2] = 2 * p;
      now = f4 * now;
    }
    ops.emplace_back(now);
  }

  int Q;
  cin >> Q;
  rep(i, Q) {
    int a, b;
    cin >> a >> b;
    b--;
    Matrix<ll> pos = {{xy[b].first}, {xy[b].second}, {1}};
    auto ans = ops[a] * pos;
    ll x = ans[0][0], y = ans[1][0];
    printf("%ld %ld\n", x, y);
  }
}
