#include using namespace std; #include using namespace atcoder; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i < (int)(n+1); i++) #define repn(i,a,b) for (int i = (int)(a) ; i < (int)(b+1); i++) #define repv(i, n) for (int i = (int)(n-1); i >= 0; i--) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define sz(x) ((int)(x).size()) #define cauto const auto& #define bit(n) (1LL<<(n)) #define uni(v) v.erase( unique(v.begin(), v.end()), v.end() ); using ll = long long; using P = pair; using PP = pair; using Graph = vector>; using mint = modint998244353; #ifdef LOCAL #include #define debug(...) debug::multi_print(#__VA_ARGS__, __VA_ARGS__) #else #define debug(...) (static_cast(0)) #endif int main(){ int n,m; cin >> n >> m; vector

uv; rep(i,m){ int u,v; cin >> u >> v; u--; v--; uv.push_back({u,v}); } dsu d(n); vector ans(n); repv(i,m){ if(d.same(uv[i].first,uv[i].second)){ ans[d.leader(uv[i].first)]++; continue; } d.merge(uv[i].first,uv[i].second); int tmp = max(ans[d.leader(uv[i].first)] ,ans[d.leader(uv[i].second)]); ans[d.leader(uv[i].first)] = tmp+1; ans[d.leader(uv[i].second)] = tmp+1; } cout << *max_element(all(ans)) << endl; return 0; }