#include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int N,M; cin >> N >> M; int cup[3]; for (int i = 0;i<3;i++){ cup[i] = i+1; } for (int i = 0; i> ai >> aj; std::swap(cup[ai-1],cup[aj-1]); } for (int i = 0;i<3;i++){ if (cup[i] == N){ cout << i+1 << endl; return 0; } } return 0; }