#include <bits/stdc++.h>

using namespace std;

#define MAXN 110

long long n,q;
long long a[MAXN],b[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for (long long i=1;i<=n;i++) cin>>a[i];
    for (long long i=1;i<=n;i++) b[i]=a[i];
    sort(b+1,b+n+1);
    for (long long i=1;i<=n;i++)
    {
        for (long long j=i+1;j<=n;j++)
        {
            long long val1=b[i]|b[j];
            long long val2=b[i]&b[j];
            b[i]=val1;b[j]=val2;
        }
    }
    cin>>q;
    for (long long z=0;z<q;z++)
    {
        long long t;cin>>t;
        if (t==0)
        {
            long long k;cin>>k;
            cout<<b[k]<<endl;
        }
        else
        {
            long long k,x;cin>>k>>x;a[k]=x;
            for (long long i=1;i<=n;i++) b[i]=a[i];
            sort(b+1,b+n+1);
            for (long long i=1;i<=n;i++)
            {
                for (long long j=i+1;j<=n;j++)
                {
                    long long val1=b[i]|b[j];
                    long long val2=b[i]&b[j];
                    b[i]=val1;b[j]=val2;
                }
            }
        }
    }
}