#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; i++) int main() { cin.tie(nullptr); int N, M; cin >> N >> M; vector A(3, false); A[N - 1] = true; rep(t, 0, M) { int P, Q; cin >> P >> Q; swap(A[P - 1], A[Q - 1]); } rep(i, 0, 3) if (A[i]) cout << i + 1 << '\n'; }