#include <bits/stdc++.h>

#define int long long int
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

using namespace std;

signed main()
{   ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a;
    vector<int> cnt(31,0);
    for(int i = 0;i<n;i++){
        int x;
        cin >> x;
        a.push_back(x);
        for(int j = 0;j<=30;j++){
            if(x&(1LL << j)){
                cnt[j]++;
            }
        }
    }
    vector<int> og = cnt;
   // sort(a.begin(),a.end());
   // cout << (1LL << 30);
    vector<int> b;
    /*cout << "Prvi: ";
    for(int i = 0;i<=30;i++){
        cout << cnt[i] << " ";
    }
    cout << endl;*/
    for(int i = n-1;i>=0;i--){
        int ok = 0;
        for(int j = 0;j<=30;j++){
            if(a[i] & (1LL << j)){
                if(cnt[j]>0){
                    ok+=(1LL << j);
                    cnt[j]--;
                }
            }else{
                if(cnt[j]>0){
                    ok+=(1LL << j);
                    cnt[j]--;
                }
            }
        }
        b.push_back(ok);
    }
    /*for(int i = 0;i<b.size();i++){
        cout << b[i] << " ";
    }
    cout << endl;*/
    int q;
    cin >> q;
    while(q--){
        int t,k;
        cin >> t >> k;
        if(t==0){
            cout << b[k-1] << "\n";
        }else{
            int x;
            cin >> x;
            cnt = og;
            for(int j = 0;j<=30;j++){
                if(a[k-1]&(1LL << j)){
                      cnt[j]--;
                    }
                }
            for(int j = 0;j<=30;j++){
                if(x&(1LL << j)){
                      cnt[j]++;
                    }
                }
            og = cnt;
            a[k-1] = x;
          /*  cout << "Drugi: ";
            for(int i = 0;i<=30;i++){
                cout << cnt[i] << " ";
            }*/
            b.clear();
            //cout << endl;
            for(int i = n-1;i>=0;i--){
                int ok = 0;
                    for(int j = 0;j<=30;j++){
                        if(a[i] & (1LL << j)){
                            if(cnt[j]>0){
                                ok+=(1LL << j);
                                cnt[j]--;
                            }
                        }else{
                            if(cnt[j]>0){
                                ok+=(1LL << j);
                                cnt[j]--;
                            }
                        }
                    }
                b.push_back(ok);
                }
              /*  for(int i = 0;i<n;i++){
                    cout << b[i] << " ";
                }*/
           /* for(int i = 0;i<b.size();i++){
                    cout << b[i] << " ";
                }
                cout << endl;*/
        }
    }
    return 0;
}