Problem: Mayor of city M. decided to launch several new metro lines during 2020. Since the city has a very limited budget, it was decided not to dig new tunnels but to use the existing underground network.

The tunnel system of the city M. consists of n metro stations. The stations are connected with n - 1 bidirectional tunnels. Between every two stations v and u there is exactly one simple path. Each metro line the mayor wants to create is a simple path between stations a_i and b_i. Metro lines can intersects freely, that is, they can share common stations or even common tunnels. However, it's not yet decided which of two directions each line will go. More precisely, between the stations a_i and b_i the trains will go either from a_i to b_i, or from b_i to a_i, but not simultaneously.

The city M uses complicated faring rules. Each station is assigned with a positive integer c_i — the fare zone of the station. The cost of travel from v to u is defined as c_u - c_v roubles. Of course, such travel only allowed in case there is a metro line, the trains on which go from v to u. Mayor doesn't want to have any travels with a negative cost, so it was decided to assign directions of metro lines and station fare zones in such a way, that fare zones are strictly increasing during any travel on any metro line.

Mayor wants firstly assign each station a fare zone and then choose a lines direction, such that all fare zones are increasing along any line. In connection with the approaching celebration of the day of the city, the mayor wants to assign fare zones so that the maximum c_i will be as low as possible. Please help mayor to design a new assignment or determine if it's impossible to do. Please note that you only need to assign the fare zones optimally, you don't need to print lines' directions. This way, you solution will be considered correct if there will be a way to assign directions of every metro line, so that the fare zones will be strictly increasing along any movement of the trains.

Input

The first line contains an integers n, m (2 ≤ n, ≤ 500 000,\ 1 ≤ m ≤ 500 000) — the number of stations in the city and the number of metro lines.

Each of the following n-1 lines describes another metro tunnel. Each tunnel is described with integers v_i, u_i (1 ≤ v_i,\ u_i ≤ n, v_i ≠ u_i). It's guaranteed, that there is exactly one simple path between any two stations.

Each of the following m lines describes another metro line. Each line is described with integers a_i, b_i (1 ≤ a_i,\ b_i ≤ n, a_i ≠ b_i).

Output

In the first line print integer k — the maximum fare zone used.

In the next line print integers c_1, c_2, …, c_n (1 ≤ c_i ≤ k) — stations' fare zones. 

In case there are several possible answers, print any of them. In case it's impossible to assign fare zones, print "-1".

Examples

Input


3 1
1 2
2 3
1 3


Output


3
1 2 3


Input


4 3
1 2
1 3
1 4
2 3
2 4
3 4


Output


-1


Input


7 5
3 4
4 2
2 5
5 1
2 6
4 7
1 3
6 7
3 7
2 1
3 6


Output


-1

Note

In the first example, line 1 → 3 goes through the stations 1, 2, 3 in this order. In this order the fare zones of the stations are increasing. Since this line has 3 stations, at least three fare zones are needed. So the answer 1, 2, 3 is optimal.

In the second example, it's impossible to assign fare zones to be consistent with a metro lines.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 9;
const long long mod = 998244353;
int n, m;
vector<int> g[N];
namespace dsu {
int fa[N], v[N];
int find(int x) {
  if (fa[x] == x) return x;
  int f = fa[x];
  fa[x] = find(f);
  v[x] ^= v[f];
  return fa[x];
}
void build() {
  for (int i = (1); i < (n + 1); ++i) fa[i] = i, v[i] = 0;
}
void merge(int x, int y, int vv) {
  int px = find(x), py = find(y);
  if (px == py) {
    if (v[x] ^ v[y] ^ vv) {
      printf("-1");
      exit(0);
    }
  } else {
    fa[px] = py;
    v[px] = v[x] ^ v[y] ^ vv;
  }
}
}  // namespace dsu
namespace TR {
int fa[N], S[N], SS[N], sz[N], top[N], dfn[N], pos[N], dep[N];
void dfs(int u) {
  sz[u] = 1;
  for (auto v : g[u]) {
    if (v == fa[u]) continue;
    dep[v] = dep[u] + 1, fa[v] = u;
    dfs(v);
    sz[u] += sz[v];
  }
}
void dfs2(int u, int tp) {
  top[u] = tp;
  dfn[u] = ++*dfn;
  pos[*dfn] = u;
  int k = 0;
  for (auto v : g[u]) {
    if (v == fa[u]) continue;
    if (sz[v] > sz[k]) k = v;
  }
  if (k) dfs2(k, tp);
  for (auto v : g[u]) {
    if (v == fa[u] || v == k) continue;
    dfs2(v, v);
  }
}
void build() {
  dfs(1);
  dfs2(1, 1);
}
int LCA(int u, int v) {
  for (; top[u] != top[v]; u = fa[top[u]]) {
    if (dep[top[u]] < dep[top[v]]) swap(u, v);
  }
  return dep[u] < dep[v] ? u : v;
}
int jmp(int x, int f) {
  for (;;) {
    if (dep[top[x]] == dep[top[f]]) return pos[dfn[f] + 1];
    if (dep[top[x]] == dep[f] + 1) return top[x];
    x = fa[top[x]];
  }
}
void cont(int u, int v) {
  int f = LCA(u, v);
  ++S[u], ++S[v], S[f] -= 2;
  if (u ^ f) ++SS[u], --SS[u = jmp(u, f)];
  if (v ^ f) ++SS[v], --SS[v = jmp(v, f)];
  if ((u ^ f) && (v ^ f)) dsu::merge(u, v, 1);
}
void build2() {
  for (int i = (n + 1) - 1; i >= (1); --i) {
    int u = pos[i];
    S[fa[u]] += S[u];
    SS[fa[u]] += SS[u];
    if (SS[u]) dsu::merge(u, fa[u], 0);
  }
}
}  // namespace TR
int q[N], dp[N], v0[N], v1[N], T, vis[N], tag[N], c[N];
bool check(int K) {
  for (int i = (n + 1) - 1; i >= (1); --i) {
    int u = TR::pos[i], f = TR::fa[u];
    *q = 0;
    ++T;
    for (auto v : g[u]) {
      if (v == f || !TR::S[v]) continue;
      int x = dsu::find(v);
      if (vis[x] != T) vis[x] = T, v0[x] = 0, v1[x] = 0, q[++*q] = x;
      if (!dsu::v[v])
        v0[x] = max(v0[x], dp[v]);
      else
        v1[x] = max(v1[x], dp[v]);
    }
    int vl = 0, vr = 0;
    if (T == vis[dsu::fa[u]]) {
      int x = dsu::fa[u];
      vl = v0[x], vr = v1[x];
      if (dsu::v[u]) swap(vl, vr);
    }
    int vmn = 0, vmx = 0;
    for (int j = (1); j < ((*q) + 1); ++j) {
      if (dsu::fa[u] != q[j]) {
        if (v0[q[j]] > v1[q[j]]) swap(v0[q[j]], v1[q[j]]);
        vmn = max(vmn, v0[q[j]]);
        vmx = max(vmx, v1[q[j]]);
      }
    }
    if (max(vmn, min(vl, vr)) + max(vmx, max(vl, vr)) >= K) return 0;
    dp[u] =
        (max(vmn, vl) + max(vmx, vr) >= K ? max(vmx, vl) : max(vmn, vl)) + 1;
  }
  return 1;
}
void construct(int K) {
  for (int i = (1); i < (n + 1); ++i) {
    int u = TR::pos[i], f = TR::fa[u];
    *q = 0;
    ++T;
    for (auto v : g[u]) {
      if (v == f || !TR::S[v]) continue;
      int x = dsu::fa[v];
      if (vis[x] != T) vis[x] = T, v0[x] = 0, v1[x] = 0, q[++*q] = x;
      if (!dsu::v[v])
        v0[x] = max(v0[x], dp[v]);
      else
        v1[x] = max(v1[x], dp[v]);
    }
    for (int j = (1); j < ((*q) + 1); ++j) {
      c[q[j]] = tag[u];
      if (q[j] != dsu::fa[u])
        c[q[j]] ^= (v0[q[j]] > dp[u] - 1 || v1[q[j]] + dp[u] > K);
      else
        c[q[j]] ^= dsu::v[u];
    }
    for (auto v : g[u]) {
      if (v == f || !TR::S[v]) continue;
      tag[v] = c[dsu::fa[v]] ^ dsu::v[v];
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i < (n); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  TR::build();
  dsu::build();
  for (int i = (0); i < (m); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    TR::cont(u, v);
  }
  TR::build2();
  for (int i = (1); i < (n + 1); ++i) dsu::find(i);
  int l = 1, r = n;
  while (l < r) {
    int mid = l + r >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  check(l);
  construct(l);
  printf("%d\n", l);
  for (int i = (1); i < (n + 1); ++i)
    printf("%d ", !tag[i] ? dp[i] : l + 1 - dp[i]);
}