#include <bits/stdc++.h>
#define ll long long
#define MAXN 100010
using namespace std;
ll a[MAXN],b[MAXN];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n,q,t,k,x;
    cin >> n;
    for (ll i=1;i<=n;i++)
        cin >> a[i];
    cin >> q;
    while (q--)
    {
        cin >> t >> k;
        if (t==1)
        {
            cin >> x;
            a[k]=x;
            continue;
        }
        for (ll i=1;i<=n;i++)
            b[i]=a[i];
        for (ll i=1;i<=n;i++)
        {
            for (ll j=0;j<30;j++)
            {
                ll maxx=b[i],pos=-1;
                for (ll p=i+1;p<=n;p++)
                {
                    if ((b[i]|b[p])>maxx)
                    {
                        maxx=(b[i]|b[p]);
                        pos=p;
                    }
                    else if ((b[i]|b[p])==maxx && pos!=-1 && (b[pos]&b[i])<(b[p]&b[i]))
                    {
                        maxx=p;
                        pos=p;
                    }
                }
                if (pos==-1)
                    break;
                ll x=b[pos]&b[i],y=b[pos]|b[i];
                b[i]=y;
                b[pos]=x;
            }
        }
        cout << b[k] << "\n";
    }
    return 0;
}