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