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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextLong();
  vector<ll> X(N), Y(N);
  REP(i, N) {
    X[i] = nextLong();
    Y[i] = nextLong();
  }
  int M = nextLong();
  vector<ll> dirX(M+1), dirY(M+1), offsetX(M+1), offsetY(M+1);
  dirX[0] = 0;
  dirY[0] = 1;
  REP(i, M) {
    int t = nextLong();
    if (t == 2) {
      dirX[i+1] = (dirY[i] + 2) % 4;
      dirY[i+1] = (dirX[i] + 0) % 4;
      offsetX[i+1] = -offsetY[i];
      offsetY[i+1] = offsetX[i];
    }
    if (t == 1) {
      dirX[i+1] = (dirY[i] + 0) % 4;
      dirY[i+1] = (dirX[i] + 2) % 4;
      offsetX[i+1] = offsetY[i];
      offsetY[i+1] = -offsetX[i];
    }
    if (t == 3) {
      int p = nextLong();
      dirX[i+1] = (dirX[i] + 2) % 4;
      dirY[i+1] = dirY[i];
      offsetX[i+1] = -offsetX[i] + 2 * p;
      offsetY[i+1] = offsetY[i];
    }
    if (t == 4) {
      int p = nextLong();
      dirX[i+1] = dirX[i];
      dirY[i+1] = (dirY[i] + 2) % 4;
      offsetX[i+1] = offsetX[i];
      offsetY[i+1] = -offsetY[i] + 2 * p;
    }
  }
  int Q = nextLong();
  REP(i, Q) {
    int A = nextLong();
    int B = nextLong() - 1;
    ll x = dirX[A] == 0 ? X[B] :
           dirX[A] == 1 ? Y[B] :
           dirX[A] == 2 ? -X[B] : -Y[B];
    ll y = dirY[A] == 0 ? X[B] :
           dirY[A] == 1 ? Y[B] :
           dirY[A] == 2 ? -X[B] : -Y[B];
    x += offsetX[A];
    y += offsetY[A];
    cout << x << " " << y << '\n';
  }
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 2e5 + 10 ;

int n , m , q ;

long long x[MAX] , y[MAX] ;
int op[MAX] , p[MAX] ;

vector< pair<int , int> >queries[MAX] ;

long long ansx[MAX] , ansy[MAX] ;
int sign[2] = {1 , 1} ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	for(int i = 0 ; i < n ; ++i)
		cin>>x[i]>>y[i] ;
	cin>>m ;
	for(int i = 0 ; i < m ; ++i)
	{
		cin>>op[i] ;
		if(op[i] > 2)
			cin>>p[i] ;
	}
	cin>>q ;
	for(int i = 0 ; i < q ; ++i)
	{
		int x , y ;
		cin>>x>>y ;
		queries[x].emplace_back(y-1 , i) ;
	}
	long long a = 0 , b = 0 ;
	bool flag = false ;
	for(int i = 0 ; i <= m ; ++i)
	{
		for(auto &qu : queries[i])
		{
			int idx1 = qu.first , idx2 = qu.second ;
			if(!flag)
				ansx[idx2] = sign[0] * x[idx1] + a , ansy[idx2] = sign[1] * y[idx1] + b ;
			else
				ansx[idx2] = sign[0] * y[idx1] + a , ansy[idx2] = sign[1] * x[idx1] + b ;
		}
		if(i == m)
			break ;
		if(op[i] <= 2)
		{
			flag = !flag ;
			if(op[i] == 1)
				a *= -1 , sign[0] *= -1 ;
			else
				b *= -1 , sign[1] *= -1 ;
			swap(a , b) ;
			swap(sign[0] , sign[1]) ;
		}
		else
		{
			if(op[i] == 3)
				a = 2 * p[i] - a , sign[0] *= -1 ;
			else
				b = 2 * p[i] - b , sign[1] *= -1 ;
		}
	}
	for(int i = 0 ; i < q ; ++i)
		cout<<ansx[i]<<" "<<ansy[i]<<"\n" ;
	return 0 ;
}		