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

vector<int> a(MAXN);
vector<int> b(MAXN);
int n;

int solve0(int k, vector<int> niz){
    b = niz;
	for(int i = 0; i < n-1; i++){
		int zbir = b[i];
		for(int j = i+1; j < n; j++){
			if(!(b[j] == (b[j] & zbir))){
				int temp = b[j];
				b[j] = b[j] & zbir;
				zbir = zbir | temp;
			}
		}
		b[i] = zbir;
	}
	return b[k-1];
}

void solve1(int k, int x){
    a[k-1] = x;
}

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> 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;
			solve1(k, x);
			brojac++;
		}
		else{
			if(brojac >= pamti){
                cout<<solve0(k, a)<<'\n';
                pamti = brojac+1;
			}
			else cout<<b[k-1]<<'\n';
		}
	}
}