func_code_string: #include <bits/stdc++.h>   using namespace std;   const int64_t INF = (1 << 30) - 1;   const long long oo = (1ll << 62) - 1;   const long double PI = 3.1415926535898;   const int64_t N = 100000 + 5;   int64_t n;   vector<int64_t> a[N];   int64_t d[5][N];   int64_t mau[N];   int64_t c[5][5];   int64_t dfs(int64_t u, int64_t p, int64_t col, int64_t vt) {     col %= 3;     col += 1;     int64_t ans = d[c[vt][col]][u];     for (int64_t v : a[u]) {       if (v == p) continue;       ans += dfs(v, u, col, vt);     }     return ans;   }   void dfs2(int64_t u, int64_t p, int64_t col, int64_t vt) {     col %= 3;     col += 1;     mau[u] = c[vt][col];     for (int64_t v : a[u]) {       if (v == p) continue;       dfs2(v, u, col, vt);     }   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n;     for (int64_t i = 1; i <= n; i++) cin >> d[1][i];     for (int64_t i = 1; i <= n; i++) cin >> d[2][i];     for (int64_t i = 1; i <= n; i++) cin >> d[3][i];     for (int64_t i = 1; i < n; i++) {       int64_t u, v;       cin >> u >> v;       a[u].push_back(v);       a[v].push_back(u);     }     for (int64_t i = 1; i <= n; i++) {       if (a[i].size() >= 3) {         cout << -1;         return 0;       }     }     c[1][1] = 1;     c[1][2] = 2;     c[1][3] = 3;     c[2][1] = 1;     c[2][2] = 3;     c[2][3] = 2;     int64_t s = 1;     while (a[s].size() == 2) s++;     int64_t res = oo, col, vt;     for (int64_t i = 1; i <= 2; i++) {       for (int64_t j = 1; j <= 3; j++) {         int64_t ans = dfs(s, s, j - 1, i);         if (ans < res) {           res = ans;           col = j;           vt = i;         }       }     }     dfs2(s, s, col - 1, vt);     cout << res <<   n ;     for (int64_t i = 1; i <= n; i++) cout << mau[i] <<    ;   }   