#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, co = 0, cn = 0, q;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] == 1)
            co++;
        if(a[i] == 0)
            cn++;
    }
    for(int i = 1; i <= n; i++)
        b[i] = a[i];
    if(cn + co == n){
        sort(b, b+n);
        cin >> q;
        while(q--){
            int t, k, x;
            cin >> t >> k;
            if(t == 1){
                cin >> x;
                a[k] = x;
                for(int i = 1; i <= n; i++)
                    b[i] = a[i];
                sort(b, b+n);
            }
            else
                cout << b[k] << endl;
        }
        return 1;
    }
    for(int i = 1; i <= n; i++)
        b[i] = a[i];
    solve(b, n);
    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;
}