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