#include <bits/stdc++.h>
using namespace std;
const int N=300010,M=500010;
typedef long long ll;
int n,m,cnt;
ll s[N],f[N],fa[N],ff[N],sum[N],d[M];
int find (ll x) {
if (f[x]==x) return x;
int p=f[x];
f[x]=find(f[x]);
sum[x]=sum[x]^sum[p]^s[p];
return f[x];
}
int main () {
freopen("td.in","r",stdin);
freopen("td.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin >> n >> m;
for (int i=1;i<=n;i++) f[i]=i;
for (int i=1;i<=n;i++) cin >> s[i],sum[i]=s[i];
while (m--) {
int p,a,b;
cin >> p;
if (p==1) {
cin >> a >> b;
int fy=find(b);
if (a==fy) continue;
f[a]=b;
sum[a]=sum[a]^sum[b];
//s[a]^=s[b];
//sum[fy]=s[fx];
}else{
cin >> a;
find(a);
cout << sum[a] <<"\n";
//cout << cnt <<endl;
}
}
return 0;
}