#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;
struct edge{
	int u,v;
};
int dcc[N];//点在那个边双联通分量中
bool brige[N];//判割边
stack<int> s;
vector<edge> e;//边集
vector<int> h[N];//出边,存的是e中边的编号
int cnt;//边双联通分量个数

int dfn[N],low[N],tot;
void add(int a,int b){
	e.push_back({a,b});
	h[a].push_back(e.size()-1);//a点的出边编号
}
void tarjan(int x,int no_edg){//no_edg是x的入边编号
	dfn[x]=low[x]=++tot;
	s.push(x);
	for(int i=0;i<h[x].size();i++){
		int j=h[x][i];//x的出边
		int y=e[j].v;
		if(!dfn[y]){
			tarjan(y,j);
			low[x]=min(low[x],low[y]);
			if(low[y]>dfn[x]){//判割边
				brige[j]=brige[j^1]=1;
			}
		}
		else if(j!=no_edg^1){//j不是反向边
			low[x]=min(low[x],dfn[y]);
		}
	}
	if(low[x]==dfn[x]){//判点双联通分量
		++cnt;
		int p=0;
		do{
			p=s.top();
			s.pop();
			dcc[p]=cnt;
		}while(p!=x);
	}
}
void solve(){
	int n,m;cin>>n>>m;
	while(m--){
		int x,y;cin>>x>>y;
		add(x,y);
		add(y,x);
	}
	tarjan(1,0);
}


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