#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
long long a[1000001], b[1000001];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //nt a = 1<<10;
    //cout << a;
    /*int m, a, b;
    cin >> a >> b;
    int c = a&b, d = a|b;
    cout << c << " " << d;*/
    long long n, q, t, k, x, i, j, bi, bj;
    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    cin >> q;
    while (q--)
    {
        cin >> t >> k;
        if (t == 1)
        {
            cin >> x;
            a[k-1] = x;
            continue;
        }
        for (i = 0; i < n; i++)
        {
            b[i] = a[i];
        }
        for (i = 0; i < n; i++)
        {
            for (j = i+1; j < n; j++)
            {
                bi = max(b[i]&b[j],b[i]|b[j]);
                bj = min(b[i]&b[j],b[i]|b[j]);
                b[i] = bi; b[j] = bj;
            }
        }
        cout << b[k-1] << endl;
    }
    return 0;
}