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

vector<int> a(MAXN);
vector<int> b(MAXN);
int n;
map<int, int> mapa;

void solve(int k, vector<int> niz){
    b = niz;
    for(int i = 0; i < n; i++){
        int zbir = 0;
        for(auto x : mapa){
            if(x.second > 0){
                mapa[x.first]--;
                mapa[x.first & zbir]++;
                zbir = zbir | x.first;
            }
        }
        b[i] = zbir;
    }
}

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		mapa[a[i]]++;
	}
	int q; cin >> q;
	int brojac = 0;
	int pamti = 0;
	while(q--){
		int t, k; cin >> t >> k;
		if(t == 1){
			int x; cin >> x;
			a[k-1] = x;
			brojac++;
		}
		else{
            if(brojac >= pamti){
                pamti = brojac+1;
                solve(k, a);
                cout<<b[k-1]<<'\n';
            }
            else{
                cout<<b[k-1]<<'\n';
            }
		}
	}
}