func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, rt, c[200005], col[200005];   vector<int> son[200005], b;   long long a[200005][5];   void dfs(int x, int fa) {     b.push_back(x);     for (int i = 0; i < son[x].size(); i++) {       if (son[x][i] == fa) continue;       dfs(son[x][i], x);     }   }   int main() {     cin >> n;     for (int j = 1; j <= 3; j++) {       for (int i = 1; i <= n; i++) {         scanf( %d , &a[i][j]);       }     }     int x, y;     for (int i = 1; i < n; i++) {       scanf( %d%d , &x, &y);       son[x].push_back(y);       son[y].push_back(x);     }     for (int i = 1; i <= n; i++) {       if (son[i].size() > 2) {         puts( -1 );         return 0;       }       if (son[i].size() == 1) rt = i;     }     if (n == 1) {       cout << min(a[1][1], min(a[1][2], a[1][3])) << endl;       return 0;     }     dfs(rt, 0);     long long ans = 1e16;     for (int i = 1; i <= 3; i++) {       for (int j = 1; j <= 3; j++) {         if (i == j) continue;         long long s = a[b[0]][i] + a[b[1]][j];         c[0] = i, c[1] = j;         for (int k = 2; k < b.size(); k++) {           c[k] = 6 - c[k - 1] - c[k - 2];           s += a[b[k]][c[k]];         }         if (ans > s) {           ans = s;           for (int i = 0; i < n; i++) {             col[b[i]] = c[i];           }         }       }     }     cout << ans << endl;     for (int i = 1; i <= n; i++) {       printf( %d  , col[i]);     }     return 0;   }   