#include <bits/stdc++.h>

using namespace std;

const int maxn=3e5+5;
int tree[4*maxn];

void upd(int node,int lo,int hi,int p,int val){
    if(lo>hi || lo>p || hi<p){
        return;
    }
    if(lo==hi){
        tree[node]^=val;
        return;
    }
    int mid=(lo+hi)/2;
    upd(node<<1,lo,mid,p,val);
    upd(node<<1 | 1,mid+1,hi,p,val);
    tree[node]=tree[node<<1]^tree[node<<1 | 1];
}

int get(int node,int lo,int hi,int l,int r){
    if(lo>hi || lo>r || hi<l){
        return 0;
    }
    if(lo>=l && hi<=r){
        return tree[node];
    }
    int mid=(lo+hi)/2;
    return get(node<<1,lo,mid,l,r)^get(node<<1 | 1,mid+1,hi,l,r);
}

int main()
{
    int n,q;
    cin>>n>>q;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
      	upd(1,0,n-1,i,a[i]);
    }
    while(q--){
        int ty;
        cin>>ty;
        if(ty==1){
            int i,val;
            cin>>i>>val;
            --i;
            upd(1,0,n-1,i,val);
        }
        else{
            int u,v;
            cin>>u>>v;
            --u,--v;
            cout<<get(1,0,n-1,u,v)<<'\n';
        }
    }
}

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

using ll=long long;
const int Nmax=200009;
int N, M, Q;
ll X[Nmax], Y[Nmax];
struct Data {ll a, b, c;};
Data xp[Nmax], yp[Nmax];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    xp[0]={1, 0, 0}; yp[0]={0, 1, 0};
    cin>>N;
    for(int i=1; i<=N; i++) cin>>X[i]>>Y[i];
    cin>>M;
    for(int i=1; i<=M; i++) {
        Data &x=xp[i-1], &y=yp[i-1];
        int op;
        cin>>op;
        if(op==1) {
            xp[i]={y.a, y.b, y.c};
            yp[i]={-x.a, -x.b, -x.c};
        }
        else if(op==2) {
            xp[i]={-y.a, -y.b, -y.c};
            yp[i]={x.a, x.b, x.c};
        }
        else if(op==3) {
            ll p;
            cin>>p;
            xp[i]={-x.a, -x.b, 2*p-x.c};
            yp[i]={y.a, y.b, y.c};
        }
        else if(op==4) {
            ll p;
            cin>>p;
            xp[i]={x.a, x.b, x.c};
            yp[i]={-y.a, -y.b, 2*p-y.c};
        }
    }
    cin>>Q;
    while(Q--) {
        int A, B;
        cin>>A>>B;
        cout<<(xp[A].a*X[B]+xp[A].b*Y[B]+xp[A].c)<<" ";
        cout<<(yp[A].a*X[B]+yp[A].b*Y[B]+yp[A].c)<<"\n";
    }
    return 0;
}
