#include <queue>
#include <cstdio>
#include <algorithm>
int v, c;
template <class T> T read(T& x) {
x = 0; v = 1; c = getchar();
for (; c < '0' || c > '9'; c = getchar()) if (c == '-') v = -1;
for (; c >= '0' && c <= '9'; c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
return x *= v;
}
const int N = 500010;
int n, m, x, y, ans, du[N];
int cnt, head[N];
bool vis[N], inq[N];
struct Edge {
int y, nxt;
} e[N];
inline void add(int x, int y) {
e[++cnt].y = y; e[cnt].nxt = head[x]; head[x] = cnt;
}
std::queue <int> q;
void topo() {
for (; !q.empty(); ) {
int x = q.front(); q.pop();
vis[x] = 1;
for (int i = head[x]; i; i = e[i].nxt) {
int y = e[i].y;
--du[y];
if (!vis[y] && !inq[y] && du[y] < 3) {
inq[y] = 1; q.push(y);
}
}
}
}
int main() {
freopen("asm_game.in", "r", stdin);
freopen("asm_game.out", "w", stdout);
read(n); read(m);
for (int i = 1; i <= m; ++i) {
read(x); read(y);
add(x, y); add(y, x);
++du[x]; ++du[y];
}
for (int i = 1; i <= n; ++i) {
if (du[i] < 3) {
inq[i] = 1; q.push(i);
}
}
topo();
for (int i = 1; i <= n; ++i) {
if (!vis[i]) ans ^= i;
}
printf("%d\n", ans);
return 0;
}