#include using namespace std; typedef long long ll; ll gcd(ll a, ll b){ if(b == 0)return a; return gcd(b, a % b); } ll lcm(ll a, ll b){ return a / gcd(a, b) * b; } int N, K; int nxt[55]; bool used[55]; int dfs(int now){ if(used[now])return 0; used[now] = true; return 1 + dfs(nxt[now]); } ll solve(){ ll res = 1; for(int i=0;i> N >> K; for(int i=0;i> X >> Y; --X; --Y; swap(nxt[X], nxt[Y]); } cout << solve() << endl; return 0; }