func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O3 )   #pragma GCC target( avx2 )   using namespace std;   long long one = 1;   const long long INF = 1e18;   const long long MOD = 1e9 + 7;   const long long N = 2e5;   vector<vector<long long> > c, gr;   vector<long long> res;   bool flag = 1;   long long dfs1(long long v, long long p, long long j, long long k) {     long long ans = c[j][v];     if (gr[v].size() > 2) flag = 0;     for (long long u : gr[v]) {       if (u == p) continue;       ans += dfs1(u, v, k, 3 - j - k);     }     return ans;   }   void dfs2(long long v, long long p, long long j, long long k) {     res[v] = j + 1;     for (long long u : gr[v]) {       if (u == p) continue;       dfs2(u, v, k, 3 - j - k);     }   }   signed main() {     long long n;     cin >> n;     c.resize(3);     for (long long i = 0; i < 3; i++) {       c[i].resize(n);       for (long long j = 0; j < n; j++) cin >> c[i][j];     }     gr.resize(n);     for (long long i = 0; i < n - 1; i++) {       long long v, u;       cin >> v >> u;       v--;       u--;       gr[v].push_back(u);       gr[u].push_back(v);     }     long long st = -1;     for (long long i = 0; i < n; i++) {       if (gr[i].size() == 1) st = i;     }     long long ans = INF, ansj = -1, ansk = -1;     for (long long j = 0; j < 3; j++) {       for (long long k = 0; k < 3; k++) {         if (j == k) continue;         long long smth = dfs1(st, -1, j, k);         assert(smth >= 0);         if (smth < ans) {           ans = smth;           ansj = j;           ansk = k;         }       }     }     if (flag == 0) {       cout << -1 << endl;       return 0;     }     if (n > 20000) {     }     res.resize(n);     cout << ans << endl;     dfs2(st, -1, ansj, ansk);     for (long long i : res) cout << i <<    ;   }   