func_code_string: #include <bits/stdc++.h>      using namespace std;   #define N 200020   int cnt, last[N], n, ans;   struct edge {       int to, next;   } e[N << 1];      inline void add(int u, int v) {       e[++cnt] = {v, last[u]}, last[u] = cnt;       e[++cnt] = {u, last[v]}, last[v] = cnt;   }      int dfs(int x, int fa) {       vector<pair<int, int> > q;       q.clear();       for (int i = last[x]; i; i = e[i].next) {           int y = e[i].to;           if (y == fa)continue;           q.push_back({dfs(y, x), y});       }       if (!q.size())return 0;       sort(q.begin(), q.end());       for (int i = 1; i < q.size(); ++i) {           ans = max(q[i - (x == 1)].first + 2, ans);       }       return q[(q.size() - 1) * (x == 1)].first + 1;   }      inline void solve() {       scanf( %d , &n);       for (int i = 1; i <= n; ++i)last[i] = 0;       cnt = 0;       for (int i = 1; i < n; ++i) {           int u, v;           scanf( %d%d , &u, &v);           add(u, v);       }       ans = 0;       ans = max(ans, dfs(1, 0));       printf( %d n , ans);   }      int main() {       int T = 1;       scanf( %d , &T);       for (int i = 1; i <= T; ++i)solve();   }   