#include <iostream>

using namespace std;

const int MAXN = 100005;
int A[MAXN];
int B[MAXN];

int main()
{
#ifdef DRZAVNO
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#endif // DRZAVNO
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

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

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int t;
        cin >> t;
        if (t == 1) {
            int k;
            cin >> k;
            int x;
            cin >> x;
            A[k] = x;
        }
        if (t == 0) {
            int k;
            cin >> k;
            for (int i = 1; i <= n; i++) {
                B[i] = A[i];
            }

            for (int i = 1; i <= n; i++) {
                for (int j = i+1; j <= n; j++) {
                    int u, v;
                    u = B[i];
                    v = B[j];
                    B[i] = u | v;
                    B[j] = u & v;
                }
            }

            cout << B[k] << endl;
        }

    }


    return 0;
}