//#include #include using namespace std; //using namespace atcoder; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; Graph G; vll dist; vector seen; ll gcd(ll(a), ll(b)) { ll c = a; while (a % b != 0) { c = a % b; a = b; b = c; } return b; } int main() { ll N,M; cin>>N>>M; vector AN(4,false); AN[N]=true; rep(i,M){ ll A,B; string R; cin>>A>>B; swap(AN[A],AN[B]); } rep(i,4){ if(AN[i])cout<