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

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

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

void solve1(int k, int 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;
	while(q--){
		int t, k; cin >> t >> k;
		if(t == 1){
			int x; cin >> x;
			solve1(k, x);
		}
		else{
			cout<<solve0(k, a)<<'\n';
		}
	}
}