#include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 1, 1, -1, -1}; int dx[]={1, -1, 0, 0, 1, -1, -1, 1}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define mp make_pair #define fi first #define sc second int n,m; int main(){ cin >> n >> m; n--; bool cs[3]; REP(i,3){ cs[i] = (n == i); } REP(i,m){ int p,q; cin >> p >> q; p--;q--; bool c = cs[p]; cs[p] = cs[q]; cs[q] = c; } REP(i,3) if(cs[i]) cout << i + 1 << endl; return 0; }