#include #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define llong long long #define pb(a) push_back(a) #define INF 999999999 using namespace std; typedef pair P; typedef pair LP; typedef pair PP; typedef pair LPP; int dy[]={0, 0, 1, -1}; int dx[]={1, -1, 0, 0}; int main(){ int n; cin>>n; vector v[n]; REP(i,n-1){ int a,b; cin>>a>>b; a--; b--; v[a].pb(b); v[b].pb(a); } int kyori[n]; REP(i,n){ kyori[i] = -1; } queue q; q.push(0); kyori[0] = 0; while(!q.empty()){ int t = q.front(); q.pop(); REP(i,v[t].size()){ if(kyori[v[t][i]] == -1){ kyori[v[t][i]] = kyori[t] +1; q.push(v[t][i]); } } } int king,queen; king = 0; queen = 0; REP(i,n){ if(kyori[i]>=king){ queen = king; king = kyori[i]; } } int saicho = king + queen + 1; cout<