func_code_string: #include <iostream>   #include <vector>      using namespace std;      int l[200005], r[200005];   vector<int> e[200005];   long long int dp[2][200005];      void dfs(int u, int fa) {       dp[0][u] = dp[1][u] = 0;       for (auto v : e[u]) {           if (v == fa) continue;           dfs(v, u);           dp[0][u] += max(dp[0][v] + abs(l[u] - l[v]), dp[1][v] + abs(l[u] - r[v]));           dp[1][u] += max(dp[0][v] + abs(r[u] - l[v]), dp[1][v] + abs(r[u] - r[v]));       }   }      int main(void) {       int t;       scanf( %d , &t);       while (t--) {           int n;           scanf( %d , &n);           for (int i = 1;i <= n;i++) scanf( %d %d , &l[i], &r[i]);           for (int i = 1;i <= n;i++) e[i].clear();           for (int i = 0;i < n - 1;i++) {               int u, v;               scanf( %d %d , &u, &v);               e[u].emplace_back(v);               e[v].emplace_back(u);           }           dfs(1, -1);           printf( %lld n , max(dp[0][1], dp[1][1]));       }   }