int@n,@k,c[n];Permutation p(n);p=1;REP(k)rd(n,k),swap(p[n-1],p[n]);wt(lcm(c(p.cycle_len(c))));