#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int f[MAXN],w[MAXN],n,m;
#define fast __attribute__((optimize("-O3")))
#define IL __inline__ __attribute__((always_inline))
#define r register
template<typename _t>
fast IL _t read(){
r _t x=0,f=1;
r char ch=getchar();
for(;ch>'9'||ch<'0';ch=getchar())if(ch=='-')f=-f;
for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+(ch^48);
return x*f;
}
fast int find(r int x){
if(f[x]==x)return x;
r int o = f[x];
f[x] = find(f[x]);
if(o!=f[x])w[x]^=w[o];
return f[x];
}
int main(){
freopen("td.in","r",stdin);
freopen("td.out","w",stdout);
n=read<int>();m=read<int>();
for(r int i=1;i<=n;i++)w[i]=read<int>(),f[i]=i;
while(m--){
r int op=read<int>();
if(op==1){
r int u=read<int>(),v=read<int>();
f[u]=v;
}
else{
r int u=read<int>();
find(u);
if(f[u]!=u)
printf("%d\n",w[u]^w[f[u]]);
else printf("%d\n",w[u]);
}
}
}