import std.stdio, std.string, std.conv, std.algorithm, std.numeric; import std.range, std.array, std.math, std.typecons, std.container, core.bitop; void main() { int n = readln.chomp.to!int; int m = readln.chomp.to!int; iota(m).map!(i => readln.split.to!(int[])).fold!((a, b) => b.canFind(a[0]) ? [a[0]^b[0]^b[1],0] : [a[0], 0])([n,0]).front.writeln; }