1322_F. Assigning Fares_21627
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.
#include <bits/stdc++.h>
const int N = 5e5 + 5, M = N * 2, LN = 20;
int n, m, p[LN][N], *fa = *p;
int o[N], id[N], eid[N], dep[N], cnt;
int cov[N], tag[N], bel[M];
std::vector<int> g[N];
inline void up(int &x, int y) {
  if (x < y) x = y;
}
inline void down(int &x, int y) {
  if (x > y) x = y;
}
void dfs(int u) {
  o[++cnt] = u, id[u] = cnt;
  for (int i = 0; p[i][u]; ++i) p[i + 1][u] = p[i][p[i][u]];
  for (auto v : g[u])
    if (v != fa[u]) p[0][v] = u, dep[v] = dep[u] + 1, dfs(v);
  eid[u] = cnt;
}
int jump(int u, int d) {
  assert(dep[u] >= d);
  for (int s = dep[u] - d; s; s &= s - 1) u = p[__builtin_ctz(s)][u];
  return u;
}
namespace dsu {
int p[M];
inline int get(int x) { return x == p[x] ? x : p[x] = get(p[x]); }
inline void merge(int x, int y) {
  if ((x = get(x)) != (y = get(y))) p[x] = y;
}
inline void equiv(int x, int y) { merge(x, y), merge(((x) ^ 1), ((y) ^ 1)); }
inline void init(int n) { std::iota(p, p + n + 1, 0); }
}  // namespace dsu
namespace dp {
int f[N], stamp[N], li[N];
int l[N], r[N];
bool rev[N];
inline bool main(int k) {
  memset(stamp, 0, (n + 1) * 4);
  for (int _ = n; _; --_) {
    int u = o[_];
    int top = 0, cl = 1, cr = k, cc = (k + 1) / 2;
    for (auto v : g[u]) {
      if (v == fa[u] || !cov[v]) continue;
      int B = bel[((v) << 1)], at = B / 2;
      if (stamp[at] != _) stamp[at] = _, l[at] = 1, r[at] = k, li[top++] = at;
      B & 1 ? up(l[at], f[v] + 1) : down(r[at], k - f[v]);
    }
    int B = bel[((u) << 1)], bt = B / 2;
    for (int i = 0; i < top; ++i) {
      int y = li[i];
      if (l[y] > r[y]) return false;
      if (y == bt)
        B & 1 ? (up(cl, l[y]), down(cr, r[y]))
              : (up(cl, k + 1 - r[y]), down(cr, k + 1 - l[y]));
      else
        assert((l[y] * 2 <= k + 2) || (r[y] * 2 >= k)),
            down(cc, std::min(r[y], k + 1 - l[y])),
            up(cl, std::min(l[y], k + 1 - r[y])),
            down(cr, std::max(r[y], k + 1 - l[y]));
    }
    if (cc < cl) up(cl, k + 1 - cc);
    if ((f[u] = cl) > cr) return false;
    for (auto v : g[u]) {
      if (v == fa[u]) continue;
      int B = bel[((v) << 1)], at = B / 2;
      rev[v] =
          (B ^ (at == bt ? bel[((u) << 1)] : (l[at] <= cl && cl <= r[at]))) & 1;
    }
  }
  return true;
}
inline void calc(int k) {
  printf("%d\n", k);
  for (int i = 1; i <= n; ++i) {
    int u = o[i];
    rev[u] ^= rev[fa[u]];
    if (rev[u]) f[u] = k + 1 - f[u];
  }
  for (int i = 1; i <= n; ++i) printf("%d ", f[i]);
}
}  // namespace dp
int main() {
  scanf("%d%d", &n, &m), dsu::init(((n) << 1 | 1));
  for (int i = 1, u, v; i < n; ++i)
    scanf("%d%d", &u, &v), g[u].push_back(v), g[v].push_back(u);
  for (dfs(1); m; --m) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (id[a] > id[b]) std::swap(a, b);
    if (id[b] <= eid[a]) {
      ++cov[b], --cov[a], ++tag[b], --tag[jump(b, dep[a] + 1)];
    } else {
      if (dep[a] > dep[b]) std::swap(a, b);
      int u = a, v = jump(b, dep[a]);
      for (int i = LN - 1; ~i; --i)
        if (p[i][u] != p[i][v]) u = p[i][u], v = p[i][v];
      ++cov[a], ++cov[b], cov[fa[u]] -= 2;
      ++tag[a], ++tag[b], --tag[u], --tag[v],
          dsu::equiv(((u) << 1), ((v) << 1 | 1));
    }
  }
  for (int i = n; i; --i) {
    int u = o[i];
    cov[fa[u]] += cov[u], tag[fa[u]] += tag[u];
    if (tag[u]) dsu::equiv(((u) << 1), ((fa[u]) << 1));
  }
  for (int i = 1; i <= n; ++i)
    if ((bel[((i) << 1)] = dsu::get(((i) << 1))) ==
        (bel[((i) << 1 | 1)] = dsu::get(((i) << 1 | 1))))
      return puts("-1"), 0;
  int l = 1, r = n * 2, ans;
  while (l <= r) {
    int mid = l + r >> 1;
    if (dp::main(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  dp::main(ans), dp::calc(ans);
  return 0;
}
