#include #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define ull unsigned long long #define vi vector #define vvi vector #define DBG_N(hoge) cerr<<"!"<<" "<<(hoge)<leng){ leng=len; po=now; } for(auto a:E[now]){ if(vis[a]==false){ vis[a]=true; dfs(a,len+1); } } } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n;cin>>n; for(int i=0;i>a>>b; --a;--b; E[a].pb(b); E[b].pb(a); } vis[0]=true; dfs(0,0); leng=0; for(int i=0;i<111111;i++)vis[i]=false; dfs(po,0); cout<