#include #include #include #include using namespace std; int main() { int N, M; cin >> N >> M; vector a(3,0); a[N-1] = 1; int x1, x2; for(int i=0; i> x1 >> x2; swap(a[x1-1], a[x2-1]); } cout << find(a.begin(), a.end(), 1) - a.begin() + 1 << endl; return 0; }