#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #define INF 1050000000 using namespace std; int main(void) { int n, m; int p, q; bool b[4]; memset(b, false, sizeof(b)); cin >> n >> m; b[n] = true; for (int i = 0; i < m; i++) { cin >> p >> q; swap(b[p], b[q]); } for (int i = 1; i <= 3; i++) { if (b[i]) cout << i << endl; } }