#include<bits/stdc++.h>
#define lc p<<1
#define rc p<<1|1
#define INF 1e18
using namespace std;
#define lowbit(x) x&(-x)
#define endl '\n'
using ll = long long;
using int128 = __int128;
using pii = pair<ll,ll>;
const double PI = acos(-1);
const int N=2e4+10;
vector<int> e[N],ne[N];//ne表示新图
int dfn[N],low[N],tot;
stack<int> s;
vector<int> dcc[N];//dcc表示联通分量
bool cut[N];//是否是割点
int id[N];//新图中割点编号
int cnt;//联通分量个数
void tarjan(int u,int root){
	low[u]=dfn[u]=++tot;
	s.push(u);
	if(!e[u].size()){
		dcc[++cnt].push_back(u);
		return;
	}
	int child=0;
	for(auto v:e[u]){
		if(!dfn[v]){
			tarjan(v,root);
			low[u]=min(low[u],low[v]);
			if(low[v]>=dfn[u]){
				child++;
				if(!root||child>=2){
					cut[u]=1;
				}
				++cnt;
				int p=0;
				do{  //存联通分量
					p=s.top();
					s.pop();
					dcc[cnt].push_back(p);
				}while(p!=u);	
			}
		}
		else low[u]=min(low[u],dfn[v]);
	}
}
void solve(){
	int n,m;cin>>n>>m;
	for(int i=1;i<=m;i++){
		int u,v;cin>>u>>v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	for(int i=1;i<=n;i++){
		if(!dfn[i]) {
			tarjan(i,i);
		}
	}
	int num=cnt;//割点编号
	for(int i=1;i<=n;i++){
		if(cut[i]){
			id[i]=++num;
		}
	}
	for(int i=1;i<=cnt;i++){
		for(int j=0;j<e[i].size();j++){//新图建边
			int x=e[i][j];
			if(cut[x]){
				ne[i].push_back(id[x]);
				ne[id[x]].push_back(i);
			}
		}
	}
}


int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
//	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}