#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
inline int read() {
int op = 1, a = 0; char c = getchar();
for (; c < '0' || c > '9'; c = getchar()) if (c == '-') op = -1;
for (; c >= '0' && c <= '9'; c = getchar()) a = a * 10 + c - '0';
return op * a;
}
const int maxn = 1e5 + 5;
const int maxm = 5e5 + 5;
int n, m;
int Ecnt, head[maxn];
struct Edge { int to, nxt; } e[maxm << 1];
inline void add_edge(int u, int v) {e[++Ecnt] = (Edge) {v, head[u]}; head[u] = Ecnt;}
int deg[maxn]; bool dead[maxn];
int main() {
freopen("asm_game.in", "r", stdin);
freopen("asm_game.out", "w", stdout);
n = read(), m = read();
for (int i = 1; i <= m; i++) {
int u = read(), v = read();
add_edge(u, v), add_edge(v, u);
deg[u]++, deg[v]++;
}
queue<int> que;
for (int i = 1; i <= n; i++) {
dead[i] = 0;
if (deg[i] < 3) que.push(i);
}
for (; !que.empty(); ) {
int u = que.front(); que.pop();
if (dead[u]) continue;
dead[u] = 1;
for (int i = head[u]; i; i = e[i].nxt) {
int v = e[i].to;
if (dead[v]) continue;
if (deg[v] == 3) que.push(v);
deg[v]--;
}
}
int ans = 0;
for (int i = 1; i <= n; i++) if (!dead[i]) ans ^= i;
cout << ans << '\n';
return 0;
}