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