#include <bits/stdc++.h>

using namespace std;

int b[32];
int sz = 0;

void add(int x)
{
    for(int i = 0; i < sz; i++)
        if((x ^ b[i]) < x)
            x ^= b[i];
    for(int i = 0; i < sz; i++)
        if((x ^ b[i]) < b[i])
            b[i] ^= x;
    if(x)
    {
        b[sz++] = x;
        for(int i = sz - 1; i; i--)
            if(b[i] < b[i - 1])
                swap(b[i], b[i - 1]);
    }
}

int get(int k)
{
    k--;
    int ans = 0;
    for(int i = 0; i < sz; i++)
        if((k >> i) & 1)
            ans ^= b[i];
    return ans;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    while(n--)
    {
        int t, x;
        cin >> t >> x;
        if(t == 1)
            add(x);
        else
            cout << get(x) << "\n";
    }
}