#include <bits/stdc++.h>

#define maxn 100001

using namespace std;

int n;
int arr[maxn];
int bitovi[18];

void bits(int br) {
	while(br > 0) {
		cout << (br & 1) << "\n";
		br = br >> 1;
	}
}

void prep() {
	memset(bitovi, 0, sizeof(bitovi));
	for(int i = 0; i < n; i++) {
		int j = 0, cur = arr[i];
		while(cur > 0) {
			bitovi[j] += (cur & 1);
			cur = cur >> 1;
			j++;
		}
	}
}

void solve() {
	int t, k;
	cin >> t >> k;
	if(t == 1) {
		int x;
		cin >> x;
		int a = arr[k - 1], b = x, j = 0;
		while(a > 0) {
			bitovi[j] -= (a & 1);
			a = a >> 1;
			if(b > 0) {
				bitovi[j] += (b & 1);
				b = b >> 1;
			}
			j++;
		}
		while(b > 0) {
			bitovi[j] += (b & 1);
			b = b >> 1;
		}
		arr[k - 1] = x;
	} else {
		int c = 1, br = 0;
		for(int i = 0; i < 18; i++) {
			if(bitovi[i] >= k) br += c;
			c = c << 1;
		}
		cout << br << "\n";
	}
}

int main() {
	int q;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> arr[i];
	prep();
	cin >> q;
	while(q--) solve();
	return 0;
}