#include <bits/stdc++.h>

using namespace std;

int a[100100], b[100100];

void solve(int a[], int n){
    for(int i = 1; i < n; i++){
        for(int j = i+1; j <= n; j++){
            int x = a[i], y = a[j];
            if((x|y) > x){
                a[i] = x|y;
                a[j] = x&y;
            }
            //cout << "USO\n";
        }
    }

}
int main()
{
    int n, ind = 0;
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= n; i++)
        b[i] = a[i];
    solve(b, n);
    int q;
    cin >> q;
    while(q--){
        int t, k, x;
        cin >> t >> k;
        if(t > 0){
            cin >> x;
            a[k] = x;
            for(int i = 1; i <= n; i++)
                b[i] = a[i];
            /*for(int i = 1; i <= n; i++)
                cout << b[i] << " ";
            cout << endl;*/
            ind = 1;
        }
        else{
            if(ind == 1){
                //cout << "USO\n";
                solve(b, n);
            }
            /*for(int i = 1; i <= n; i++)
                cout << b[i] << " ";
            cout << endl;*/
            cout << b[k] << endl;
            ind = 0;
        }
    }
    return 0;
}