#include <cassert>
#include <cstdint>
#include <iostream>
#include <vector>

#define REP_(i, a_, b_, a, b, ...) \
    for (int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)

using namespace std;
using Int = int64_t;

template <class T>
struct Matrix {
    vector<vector<T>> val;

    Matrix(vector<vector<T>> vec) : val(vec) {}
    Matrix(int64_t n = 1, int64_t m = 1, T v = 0) : val(n, vector<T>(m, v)) {}
    void init(int64_t n, int64_t m, T v = 0) { val.assign(n, vector<T>(m, v)); }
    size_t size() const { return val.size(); }
    vector<T> &operator[](int64_t i) { return val[i]; }
    const vector<T> &operator[](int64_t i) const { return val[i]; }
};

template <class T>
Matrix<T> operator*(const Matrix<T> &A, const Matrix<T> &B) {
    assert(A.size() == B[0].size());
    Matrix<T> R(A.size(), B[0].size());
    for (int64_t i = 0; i < A.size(); ++i)
        for (int64_t j = 0; j < B[0].size(); ++j)
            for (int64_t k = 0; k < B.size(); ++k) R[i][j] += A[i][k] * B[k][j];

    return R;
}

template <class T>
Matrix<T> operator+(const Matrix<T> &A, const Matrix<T> &B) {
    assert(A.size() == B.size() && A[0].size() == B[0].size());
    Matrix<T> R(A.size(), A[0].size());
    for (int64_t i = 0; i < A.size(); ++i) {
        for (int64_t j = 0; j < A[0].size(); ++j) {
            R[i][j] = A[i][j] + B[i][j];
        }
    }
    return R;
}

template <class T>
Matrix<T> operator-(const Matrix<T> &A, const Matrix<T> &B) {
    assert(A.size() == B.size() && A[0].size() == B[0].size());
    Matrix<T> R(A.size(), A[0].size());
    for (int64_t i = 0; i < A.size(); ++i) {
        for (int64_t j = 0; j < A[0].size(); ++j) {
            R[i][j] = A[i][j] - B[i][j];
        }
    }
    return R;
}

template <class T>
vector<T> operator*(const Matrix<T> &A, const vector<T> &B) {
    vector<T> v(A.size());
    for (int64_t i = 0; i < A.size(); ++i) {
        for (int64_t k = 0; k < B.size(); ++k) {
            v[i] += A[i][k] * B[k];
        }
    }
    return v;
}

template <class T>
bool operator==(const Matrix<T> &A, const Matrix<T> &B) {
    assert(A.size() == B.size() && A[0].size() == B[0].size());
    for (int64_t i = 0; i < A.size(); ++i) {
        for (int64_t j = 0; j < A[0].size(); ++j) {
            if (A[i][j] != B[i][j]) {
                return false;
            }
        }
    }
    return true;
}

int main() {
    Int N;
    cin >> N;
    vector<Int> X(N), Y(N);
    REP(i, N) cin >> X[i] >> Y[i];
    Int M;
    cin >> M;
    vector<Matrix<Int>> mats;
    Matrix<Int> mat(3, 3, 0);
    mat[0][0] = 1;
    mat[1][1] = 1;
    mat[2][2] = 1;
    mats.push_back(mat);
    REP(i, M) {
        Int t;
        cin >> t;
        if (t == 1) {
            vector<vector<Int>> a = {{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}};
            Matrix<Int> A(a);
            mat = A * mat;
        } else if (t == 2) {
            vector<vector<Int>> a = {{0, -1, 0}, {1, 0, 0}, {0, 0, 1}};
            Matrix<Int> A(a);
            mat = A * mat;
        } else if (t == 3) {
            Int p;
            cin >> p;
            vector<vector<Int>> a = {{-1, 0, 2 * p}, {0, 1, 0}, {0, 0, 1}};
            Matrix<Int> A(a);
            mat = A * mat;
        } else {
            Int p;
            cin >> p;
            vector<vector<Int>> a = {{1, 0, 0}, {0, -1, 2 * p}, {0, 0, 1}};
            Matrix<Int> A(a);
            mat = A * mat;
        }
        mats.push_back(mat);
    }

    Int Q;
    cin >> Q;
    REP(i, Q) {
        Int a, b;
        cin >> a >> b;
        --b;
        vector<Int> vec = {X[b], Y[b], 1};
        auto res = mats[a] * vec;
        cout << res[0] << " " << res[1] << endl;
    }
}
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define pdd pair<double,double>
#define pii pair<ll,ll>
#define fi first
#define sec second
#define MAXN 1000000000000000005
#define N 300005
#define lgn 20


using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

ll n,q,a[300001];
ll bit[3000000];

void update(ll x,ll y) {
    // ll org = a[x];
    a[x] = ((a[x])^y);
    while(x<=n) {
        bit[x] = ((bit[x])^y);
        x+=(x&(-x));
    }
    return;
}

ll query(ll x) {
    ll ret = 0;
    while(x) {
        ret = (ret^(bit[x]));
        x-=(x&(-x));
    }
    return ret;
}

ll query(ll x,ll y) {
    return (query(x-1)^query(y));
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
    //Type Your Code Here

   	cin>>n>>q;
    for(ll i=1;i<=n;i++) {
        ll p;
        cin>>p;
        update(i,p);
    }
    while(q--) {
        ll t,x,y;
        cin>>t>>x>>y;
        if(t==1) {
            update(x,y);
        }
        else {
            cout<<query(x,y)<<"\n";
        }
    }
    // for(ll i=1;i<=10;i++) cout<<a[i]<<" ";
    // cout<<"\n";
    // for(ll i=1;i<=10;i++) cout<<bit[i]<<" ";


    return 0;
}