#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
long long c1[maxn], c2[maxn], c3[maxn];
long long col[maxn];
long long anscol[maxn];
long long idx[maxn];
bool vis[maxn];
long long ans, anss;
vector<int> e[maxn];
void dfs(int ffa, int fa, long long u) {
  int v, i;
  vis[u] = true;
  for (i = 0; i < e[u].size(); i++) {
    v = e[u][i];
    if (vis[v]) continue;
    if (ffa == 1) {
      if (fa == 2) {
        col[v] = 3;
        ans += c3[v];
      } else {
        col[v] = 2;
        ans += c2[v];
      }
    } else if (ffa == 2) {
      if (fa == 1) {
        col[v] = 3;
        ans += c3[v];
      } else {
        col[v] = 1;
        ans += c1[v];
      }
    } else {
      if (fa == 1) {
        col[v] = 2;
        ans += c2[v];
      } else {
        col[v] = 1;
        ans += c1[v];
      }
    }
    dfs(fa, col[v], v);
  }
  return;
}
int main() {
  int n, m, i, j, k, num, sum, u, v;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &c1[i]);
  }
  for (i = 1; i <= n; i++) {
    scanf("%lld", &c2[i]);
  }
  for (i = 1; i <= n; i++) {
    scanf("%lld", &c3[i]);
  }
  for (i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    idx[u]++;
    idx[v]++;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  int sym = 0;
  for (i = 1; i <= n; i++) {
    if (idx[i] == 1 && sym == 0) {
      num = i;
      sym = 2;
    }
    if (idx[i] >= 3) {
      sym = 1;
      break;
    }
  }
  if (sym == 1) {
    printf("-1\n");
    return 0;
  }
  i = num;
  anss = 1e18;
  col[i] = 1, vis[i] = true;
  col[e[i][0]] = 2, vis[e[i][0]] = true;
  ans = c1[i] + c2[e[i][0]];
  dfs(1, 2, e[i][0]);
  if (ans < anss) {
    for (i = 1; i <= n; i++) anscol[i] = col[i];
    anss = ans;
  }
  i = num;
  memset(col, 0, sizeof col);
  memset(vis, false, sizeof vis);
  col[i] = 2, vis[i] = true;
  col[e[i][0]] = 1, vis[e[i][0]] = true;
  ans = c2[i] + c1[e[i][0]];
  dfs(2, 1, e[i][0]);
  if (ans < anss) {
    for (i = 1; i <= n; i++) anscol[i] = col[i];
    anss = ans;
  }
  i = num;
  memset(col, 0, sizeof col);
  memset(vis, false, sizeof vis);
  col[i] = 1, vis[i] = true;
  col[e[i][0]] = 3, vis[e[i][0]] = true;
  ans = c1[i] + c3[e[i][0]];
  dfs(1, 3, e[i][0]);
  if (ans < anss) {
    for (i = 1; i <= n; i++) anscol[i] = col[i];
    anss = ans;
  }
  i = num;
  memset(col, 0, sizeof col);
  memset(vis, false, sizeof vis);
  col[i] = 3, vis[i] = true;
  col[e[i][0]] = 1, vis[e[i][0]] = true;
  ans = c3[i] + c1[e[i][0]];
  dfs(3, 1, e[i][0]);
  if (ans < anss) {
    for (i = 1; i <= n; i++) anscol[i] = col[i];
    anss = ans;
  }
  i = num;
  memset(col, 0, sizeof col);
  memset(vis, false, sizeof vis);
  col[i] = 2, vis[i] = true;
  col[e[i][0]] = 3, vis[e[i][0]] = true;
  ans = c2[i] + c3[e[i][0]];
  dfs(2, 3, e[i][0]);
  if (ans < anss) {
    for (i = 1; i <= n; i++) anscol[i] = col[i];
    anss = ans;
  }
  i = num;
  memset(col, 0, sizeof col);
  memset(vis, false, sizeof vis);
  col[i] = 3, vis[i] = true;
  col[e[i][0]] = 2, vis[e[i][0]] = true;
  ans = c3[i] + c2[e[i][0]];
  dfs(3, 2, e[i][0]);
  if (ans < anss) {
    for (i = 1; i <= n; i++) anscol[i] = col[i];
    anss = ans;
  }
  printf("%lld\n", anss);
  for (i = 1; i <= n; i++) {
    printf(i == 1 ? "%lld" : " %lld", anscol[i]);
  }
  printf("\n");
  return 0;
}
