#include using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; template using vc = vector; template using vvc = vc>; using pi = pair; using vi = vc; using vvi = vvc; #define rep(i,a,b) for (int i = a; i < b; i++) #define irep(i,a,b) for (int i = a; i > b; i--) #define print(n) cout << n << '\n' #define pritn(n) print(n) #define rup(a,b) (a+b-1)/b #define input(A,N) rep(i,0,N) cin>>A[i]; struct unionfind{ int n; vector parent; vector num; unionfind(int n){ this->n = n; parent = vector(n); for(int i = 0; i < n; i++) parent[i] = i; num = vector(n); for(int i = 0; i < n; i++) num[i] = 1; } int find(int n){ if (parent[n] == n) return n; parent[n] = this->find(parent[n]); return parent[n]; } int merge(int n,int m){ n = this->find(n); m = this->find(m); if (n==m) return n; parent[m] = n; num[n] += num[m]; return n; } int getnum(int n){ return num[this->find(n)]; } }; int main(){ cout << fixed << setprecision(15); int n,m; cin >> n >> m; unionfind u(n); rep(i,0,m){ int a,b; cin >> a >> b; a--;b--; a = u.find(a); b = u.find(b); if (a == b) continue; if (u.getnum(a)>u.getnum(b)) u.merge(a,b); else if(u.getnum(b)>u.getnum(a)) u.merge(b,a); else{ if(a