var i,j,x2,y2,z2,m,n,ans:longint;
x,y,x1,y1:array[-10..500000] of longint;
vis,nu,way,num:array[-10..100000] of longint;
procedure init;
begin
readln(n,m);
for i:=1 to m do
begin
readln(x2,y2);
x1[i]:=x2;
y1[i]:=y2;
inc(way[x2]);inc(nu[x2]);
inc(way[y2]);inc(nu[y2]);
end;
for i:=2 to n do
way[i]:=way[i-1]+way[i];
for i:=1 to m do
begin
inc(num[x1[i]]);inc(num[y1[i]]);
x[way[x1[i]-1]+num[x1[i]]]:=x1[i];
y[way[x1[i]-1]+num[x1[i]]]:=y1[i];
x[way[y1[i]-1]+num[y1[i]]]:=y1[i];
y[way[y1[i]-1]+num[y1[i]]]:=x1[i];
end;
end;
procedure dfs(now:longint);
var i,j:longint;
begin
vis[now]:=1;
for i:=way[now-1]+1 to way[now] do
begin
dec(nu[y[i]]);
if (nu[y[i]]<3)and(vis[y[i]]=0) then dfs(y[i]);
end;
end;
begin
assign(input,'asm_game.in');
assign(output,'asm_game.out');
reset(input);
rewrite(output);
init;
for i:=1 to n do
if (nu[i]<3)and(vis[i]=0) then dfs(i);
for j:=1 to n do
if vis[j]=0 then begin ans:=j;break;end;
for i:=j+1 to n do
if vis[i]=0 then ans:=ans xor i;
writeln(ans);
close(input);
close(output);
end.