class UnionFindWithDp: def __init__(self, n): self.n = n self.dp = [0] * n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = self.find(x) y = self.find(y) if x == y: self.dp[x] += 1 return if self.parents[x] > self.parents[y]: x, y = y, x self.parents[x] += self.parents[y] self.dp[x] = max(self.dp[x], self.dp[y]) + 1 self.parents[y] = x n, m = map(int,input().split()) edges = [] for i in range(m): u, v = map(int,input().split()) u -= 1 v -= 1 edges.append((u, v)) uf = UnionFindWithDp(n) for i in range(m-1,-1,-1): u, v = edges[i] uf.union(u, v) ans = 0 for i in range(n): ans = max(ans, uf.dp[i]) print(ans)