#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define int long long
using namespace std;
auto IN = freopen("td.in", "r", stdin);
auto OUT = freopen("td.out", "w", stdout);
auto mread = [](){int x;scanf("%lld", &x);return x;};
const int N = 3e5 + 5;
int n = mread(), m = mread(), a[N], fa[N], s[N];
pair<int, int> findfa(int x){
if(x == fa[x]){
return mp(x, 0);
}
int tmp = fa[x];
auto t = findfa(fa[x]);
fa[x] = t.fi;
if(tmp != fa[x]){
s[x] ^= t.se;
}
return mp(t.fi, s[x]);
}
signed main(){
for(int i = 1; i <= n; i ++){
a[i] = mread();
fa[i] = i;
s[i] = a[i];
}
while(m --){
int op = mread();
if(op == 1){
int x = mread(), y = mread();
if(x == y){
continue;
}
fa[x] = y;
}
else{
int x = mread();
printf("%lld\n", findfa(x).se ^ a[fa[x]]);
}
}
return 0;
}