#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;
vector<int>p[500010];
int m,n;
bool vis[100100];
int main()
{
freopen("asm_game.in","r",stdin);
freopen("asm_game.out","w",stdout);
cin>>n>>m;
for (int i=1;i<=n;i++)
vis[i]=true;
for (int i=1;i<=m;i++)
{
int u,v;
cin>>u>>v;
p[u].push_back(v);
p[v].push_back(u);
}
for (int k=1;k<=n;k++)
{
int v=1;
for (int i=1;i<=n;i++)
{
int sum=0;
for (int j=0;j<p[i].size();j++)
{
if (vis[p[i][j]])
sum++;
}
if (sum<3)
{
vis[i]=false;
v=0;
}
}
if (v) break;
}
int p=1;
int ans=0;
for (int i=1;i<=n;i++)
{
if (vis[i])
{
ans=ans^i;
p=0;
}
}
//for (int i=1;i<=n;i++)
//if (vis[i])
//cout<<i<<endl;
if (p) cout<<0;
else cout<<ans;
return 0;
}