class unionfind: def __init__(self,uni_num): self.uni_num=uni_num self.union_root = [-1 for i in range(self.uni_num + 1)] self.union_depth = [0] * (self.uni_num + 1) self.e_num=[0]*(self.uni_num+1) def find(self,x): # 親は誰? if self.union_root[x] < 0: return x else: self.union_root[x] = self.find(self.union_root[x]) return self.union_root[x] def unite(self,x, y): x = self.find(x) y = self.find(y) if x == y: self.e_num[x]+=1 return if self.union_depth[x] < self.union_depth[y]: x, y = y, x if self.union_depth[x] == self.union_depth[y]: self.union_depth[x] += 1 self.union_root[x] += self.union_root[y] self.union_root[y] = x self.e_num[x]=max(self.e_num[x],self.e_num[y])+1 def size(self,x): return -self.union_root[self.find(x)] def same(self,x,y): return self.find(x)==self.find(y) def edge(self,x): return self.e_num[self.find(x)] n,m=map(int,input().split()) uf=unionfind(n+2) e=[] for i in range(m): u,v=map(int,input().split()) e.append((u,v)) e.reverse() for u,v in e:uf.unite(u,v) print(uf.edge(1))