#include using namespace std; int main() { int N, M; cin >> N >> M; vector v(3, 0); v.at(N - 1) = 1; for (int i = 0; i < M; i++) { int n, P, Q; cin >> P >> Q; n = v.at(P - 1); v.at(P - 1) = 0; v.at(Q - 1) = n; } for (int i = 0; i < 3; i++) { if (v.at(i) == 1) { cout << i + 1 << endl; } } }