#include #include #include using namespace std; using ll = long long; ll gcd(ll a, ll b){ if(b==0) return a; else return gcd(b, a%b); } int main(void){ int n, k; cin >> n >> k; vector p(n); for(int i=0; i> x >> y; x--, y--; swap(p[x], p[y]); } ll ans=1; vector seen(n); for(int i=0; i