#include <bits/stdc++.h>
#define int long long

using namespace std;

void printajniz(vector<int>a, int n, int x){
    for (int i=0;i<n;i++){
        for (int j=i+1;j<n;j++){
            int op1 = (a[i] & a[j]);
            int op2 = (a[i] | a[j]);
            a[i] = op1;
            a[j] = op2;
        }
    }
    cout <<a[x]<<'\n';
}

void solve(){
    int n; cin >> n;
    vector<int>a(n); for (auto &t : a) cin >> t;
    int q; cin >> q;
    while (q--){
        int k,t; cin >> k >> t;
        if (k == 0) printajniz(a,n,(n - t));
        else{
            int x; cin >> x;
            
        }
    }


}

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int t = 1; //cin >> t;
    while (t--){
        solve();
    }
    return 0;
}