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 + 50;
int n, m;
vector<int> G[N];
int fa[N][20], dep[N], d[N];
void pre_dfs(int u, int f) {
  dep[u] = dep[fa[u][0] = f] + 1;
  for (int i = 1; i <= 18; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  vector<int> e;
  for (int v : G[u])
    if (v != f) e.push_back(v), pre_dfs(v, u);
  G[u] = e;
}
int LCA(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 18; ~i; i--)
    if (dep[fa[x][i]] >= dep[y]) x = fa[x][i];
  if (x == y) return x;
  for (int i = 18; ~i; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
int jmp(int x, int d) {
  for (int i = 18; ~i; i--)
    if (d >= (1 << i)) d -= 1 << i, x = fa[x][i];
  return x;
}
vector<pair<int, int> > e[N];
int blk[N], c[N], ct;
void sub_dfs(int u, int f) {
  for (int v : G[u]) sub_dfs(v, u), d[u] += d[v];
  if (d[u])
    e[u].push_back(pair<int, int>(f, 0)), e[f].push_back(pair<int, int>(u, 0));
}
void dfs(int u, int co) {
  if (c[u] >= 0 && c[u] != co) {
    puts("-1");
    exit(0);
  }
  if (c[u] >= 0) return;
  c[u] = co;
  blk[u] = ct;
  for (pair<int, int> v : e[u]) dfs(v.first, co ^ v.second);
}
pair<int, int> f[N], g[N];
int ans[N];
pair<int, int> mrg(pair<int, int> a, pair<int, int> b) {
  return pair<int, int>(max(a.first, b.first), min(a.second, b.second));
}
bool work(int u, int k) {
  for (int v : G[u])
    if (!work(v, k)) return false;
  f[u] = pair<int, int>(1, k);
  static int ex[N];
  int t = 0;
  for (int v : G[u])
    if (blk[v]) {
      if (blk[v] == blk[u]) {
        if (!c[v])
          f[u] = mrg(f[u], pair<int, int>(1, f[v].second - 1));
        else
          f[u] = mrg(f[u], pair<int, int>(f[v].first + 1, k));
      } else {
        if (!ex[blk[v]]) ex[blk[v]] = ++t, g[t] = pair<int, int>(1, k);
        int z = ex[blk[v]];
        if (!c[v])
          g[z] = mrg(g[z], pair<int, int>(1, f[v].second - 1));
        else
          g[z] = mrg(g[z], pair<int, int>(f[v].first + 1, k));
      }
    }
  for (int v : G[u]) ex[blk[v]] = 0;
  if (f[u].first > f[u].second) return false;
  pair<int, int> z(1, k);
  for (int i = 1; i <= t; i++) {
    if (g[i].first > g[i].second) return false;
    if (k - g[i].second + 1 < g[i].first)
      g[i] = pair<int, int>(k - g[i].second + 1, k - g[i].first + 1);
    z = mrg(z, g[i]);
  }
  pair<int, int> p = mrg(z, f[u]);
  pair<int, int> q =
      mrg(pair<int, int>(k - z.second + 1, k - z.first + 1), f[u]);
  if (p.first > p.second && q.first > q.second) return false;
  if (p.first > p.second)
    f[u] = q;
  else if (q.first > q.second)
    f[u] = p;
  else
    f[u] = pair<int, int>(min(p.first, q.first), max(p.second, q.second));
  return true;
}
void cope(int u, int k, bool r) {
  static int ex[N], rm[N];
  int t = 0;
  for (int v : G[u])
    if (blk[v] && blk[v] != blk[u]) {
      if (!ex[blk[v]])
        rm[ex[blk[v]] = ++t] = blk[v], g[t] = pair<int, int>(1, k);
      int z = ex[blk[v]];
      if (!c[v])
        g[z] = mrg(g[z], pair<int, int>(1, f[v].second - 1));
      else
        g[z] = mrg(g[z], pair<int, int>(f[v].first + 1, k));
    }
  for (int v : G[u]) ex[blk[v]] = 0;
  static bool rv[N];
  for (int i = 1; i <= t; i++)
    rv[rm[i]] = (g[i].first <= ans[u] && ans[u] <= g[i].second) ? 0 : 1;
  for (int v : G[u]) {
    if (!blk[v])
      ans[v] = f[v].first, cope(v, k, 0);
    else {
      bool o = blk[v] == blk[u] ? r : rv[blk[v]];
      if (!o)
        ans[v] = c[v] ? f[v].first : f[v].second;
      else
        ans[v] = c[v] ? k - f[v].first + 1 : k - f[v].second + 1;
      cope(v, k, o);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1, u, v; i < n; i++)
    scanf("%d%d", &u, &v), G[u].push_back(v), G[v].push_back(u);
  pre_dfs(1, 0);
  for (int i = 1, x, y, l; i <= m; i++) {
    scanf("%d%d", &x, &y);
    l = LCA(x, y);
    if (x != l) ++d[x], --d[jmp(x, dep[x] - dep[l] - 1)];
    if (y != l) ++d[y], --d[jmp(y, dep[y] - dep[l] - 1)];
    if (x != l && y != l)
      e[x].push_back(pair<int, int>(y, 1)),
          e[y].push_back(pair<int, int>(x, 1));
  }
  sub_dfs(1, 0);
  memset(c, -1, sizeof(c));
  for (int i = 2; i <= n; i++)
    if (!blk[i]) ++ct, dfs(i, 0);
  int l = 1, r = n;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (work(1, mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l << '\n';
  work(1, l);
  ans[1] = f[1].first;
  cope(1, l, 0);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}