#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...);}
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)

const int N = 1e5 + 3;
int a[N], ans[N];

void solve() {
    int n; cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    auto napravi = [&]() {
        for (int i = 1; i <= n; i++)
            ans[i] = a[i];
        for (int i = 1; i <= n; i++) {
            int mx = ans[i];
            for (int j = n; j > i; j--) {
                if ((ans[i] | ans[j]) > mx) {
                    mx = ans[i] | ans[j];
                    int y = ans[i] & ans[j];
                    ans[i] = mx;
                    ans[j] = y;

                }
            }

        }
    };

    int q; cin >> q;
    while (q--) {
        int type; cin >> type;
        if (type == 0) {
            int k; cin >> k;
            napravi();
            cout << ans[k] << "\n";
        } else {
            int k, x; cin >> k >> x;
            a[k] = x;
        }
    }
}

signed main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int t=1; //cin >> t;
    while (t--) {
        solve();
    }
}