#include <iostream>
#include <unordered_map>
#include <map>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <limits>
#include <algorithm>

//#include <bits/stdc++.h>

/*
bool check(std::vector<std::vector<char>>& p, int u, int v) {
    if (seen[u] || seen[v]) return false;
    seen[u] = true;
    seen[v] = true;
    for (auto it = paths[u].begin(); it != paths[u].end(); it++) {
        char c = it->first;
        std::vector<int> pp = it->second;

        for (int p = 0; p < pp.size(); p++) {
            auto finv = paths[pp[p]][c];
            if (finv.size() > 0) {

                for (int i = 0; i < finv.size(); i++) {

                }
            }
        }
    }
}*/

std::vector<int> getlex(std::vector<int> arr) {
    int n = arr.size();
    std::sort(arr.begin(), arr.end());
    std::vector<int> lex;
    int it = n-1;
    while (it > 0) {
        if (arr[it] != 0) {
            int curr = arr[it];
            arr[it] = 0;
            for (int i = it-1; i >= 0; i--) {
                    //std::cout << "Checking " << curr << " " << arr[i] << " " << (curr | arr[i]) << std::endl;
                if (curr | arr[i] > curr) {
                    int t = curr;
                    curr |= arr[i];
                    arr[i] = t & arr[i];
                }
            }
            //std::cout << "At " << it << " " << curr << std::endl;
            lex.push_back(curr);
        }
        it--;
    }
    //std::cout << lex.size() << " size" << std::endl;
    return lex;
}
int main()
{
    std::ios::sync_with_stdio(false);
    /*std::cin.tie(0);
    std::cout.tie(0);*/

    int n;
    std::cin >> n;

    std::vector<int> arr(n);
    /*int one = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> arr[i];
        if (arr[i] == 1) one++;
    }*/
    for (int i = 0; i < n; i++) {
        std::cin >> arr[i];

    }

    std::vector<int> lex = getlex(arr);

    int q;
    std::cin >> q;
    for (int i = 0; i < q; i++) {
        int a, b;
        std::cin >> a >> b;
        b--;
        if (a == 1) {
            int c;
            std::cin >> c;
            arr[b] = c;
            lex = getlex(arr);
            /*if (arr[b] == 1 && c == 0) {
                one--;
                arr[b] = 0;
            }
            else if (arr[b] == 0 && c == 1) {
                one++;
                arr[b] = 1;
            }
            else {
                arr[b] = c;
            }*/
        }
        else {
            //std::cout << ((b+1) <= one) << std::endl;
            if (b >= lex.size()) {
                std::cout << 0 << std::endl;
            }
            else{
                std::cout << lex[b] << std::endl;
            }
        }
    }

    return 0;
}