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 + 100;
void cmax(int &x, int y) { x = x < y ? y : x; }
void cmin(int &x, int y) { x = x > y ? y : x; }
int n, m, K, ts, f[N], col[N], vis[N], rev[N], dep[N], fa[N], sz[N], bel[N],
    son[N], dsu[N];
vector<int> nxt[N], G[N], pot[N];
int getfa(int x) { return x == dsu[x] ? x : dsu[x] = getfa(dsu[x]); }
void dfs1(int u, int lst) {
  sz[u] = 1;
  dep[u] = dep[lst] + 1, fa[u] = lst;
  for (auto v : nxt[u])
    if (v != fa[u]) {
      dfs1(v, u);
      sz[u] += sz[v];
      son[u] = sz[son[u]] > sz[v] ? son[u] : v;
    }
}
void dfs2(int u, int lst) {
  bel[u] = son[fa[u]] == u ? bel[fa[u]] : u;
  for (auto v : nxt[u])
    if (v != fa[u]) dfs2(v, u);
}
int LCA(int x, int y) {
  while (bel[x] != bel[y]) {
    dep[bel[x]] > dep[bel[y]] ? x = fa[bel[x]] : y = fa[bel[y]];
  }
  return dep[x] < dep[y] ? x : y;
}
int pa[N], w[N];
vector<pair<int, int> > vec;
void getpa(int x) {
  if (x == pa[x]) return;
  getpa(pa[x]);
  w[x] ^= w[pa[x]], pa[x] = pa[pa[x]];
}
void down(int u) {
  for (auto v : nxt[u])
    if (v != fa[u]) rev[v] ^= rev[u], down(v);
}
bool dp(int u) {
  pair<int, int> A = pair<int, int>(1, K), B = pair<int, int>(1, K);
  int turn = 0;
  rev[u] = 0;
  for (auto v : nxt[u])
    if (v != fa[u])
      if (!dp(v)) return 0;
  vec.clear();
  for (auto v : nxt[u])
    if (v != fa[u]) {
      if (getfa(u) == getfa(v)) cmax(A.first, f[v] + 1);
      pot[pa[v]].push_back(v), vis[pa[v]] = 0;
    }
  int flg = 0;
  for (auto x : pot[pa[u]])
    if (getfa(u) == getfa(x)) flg = w[x];
  for (auto x : pot[pa[u]])
    if (w[x] == flg)
      cmax(A.first, f[x] + 1);
    else
      cmin(A.second, K - f[x]), rev[x] ^= 1;
  for (auto v : nxt[u])
    if (v != fa[u] && vis[pa[v]] != u && pa[v] != pa[u]) {
      vis[pa[v]] = u;
      pair<int, int> now = pair<int, int>(1, K);
      for (auto x : pot[pa[v]])
        if (w[x] == 1)
          cmax(now.first, f[x] + 1);
        else
          cmin(now.second, K - f[x]);
      if (now.first + now.second > K + 1)
        swap(now.first, now.second), now.first = K + 1 - now.first,
                                     now.second = K + 1 - now.second;
      vec.push_back(now);
    }
  for (auto p : vec)
    if (p.first > A.second || p.second < A.first) turn = 1;
  B = A;
  for (auto v : nxt[u])
    if (v != fa[u]) vis[pa[v]] = 0;
  for (auto v : nxt[u])
    if (v != fa[u] && vis[pa[v]] != u && pa[v] != pa[u]) {
      vis[pa[v]] = u;
      pair<int, int> now = pair<int, int>(1, K);
      for (auto x : pot[pa[v]])
        if (w[x] == 1)
          cmax(now.first, f[x] + 1);
        else
          cmin(now.second, K - f[x]), rev[x] ^= 1;
      if (turn ^ (now.first + now.second > K + 1)) {
        swap(now.first, now.second), now.first = K + 1 - now.first,
                                     now.second = K + 1 - now.second;
        for (auto x : pot[pa[v]]) rev[x] ^= 1;
      }
      cmax(B.first, now.first), cmin(B.second, now.second);
    }
  f[u] = B.first;
  for (auto v : nxt[u])
    if (v != fa[u]) pot[pa[v]].clear();
  return B.first <= B.second;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    nxt[u].push_back(v);
    nxt[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  static int A[N], B[N];
  for (int i = 1; i <= n; ++i) dsu[i] = i;
  for (int i = 1; i <= m; ++i) {
    int x, y, z;
    scanf("%d%d", &x, &y);
    A[i] = x, B[i] = y;
    z = LCA(x, y);
    if (z == x || z == y) A[i] = B[i] = 0;
    x = getfa(x);
    while (fa[x] != z && dep[x] > dep[z])
      dsu[x] = getfa(fa[x]), x = getfa(fa[x]);
    y = getfa(y);
    while (fa[y] != z && dep[y] > dep[z])
      dsu[y] = getfa(fa[y]), y = getfa(fa[y]);
  }
  for (int i = 1; i <= n; ++i) pa[i] = getfa(i);
  for (int i = 1; i <= m; ++i)
    if (A[i] && B[i]) {
      getpa(A[i]);
      getpa(B[i]);
      if (pa[A[i]] == pa[B[i]]) {
        if (w[A[i]] == w[B[i]]) puts("-1"), exit(0);
      } else {
        if (dep[pa[A[i]]] < dep[pa[B[i]]]) swap(A[i], B[i]);
        w[pa[A[i]]] ^= (w[A[i]] == w[B[i]]), pa[pa[A[i]]] = pa[B[i]];
      }
    }
  for (int i = 1; i <= n; ++i) getpa(i);
  int L = 0, R = n;
  while (L < R - 1) {
    int mid = K = (L + R) >> 1;
    dp(1) ? R = mid : L = mid;
  }
  cout << (K = R) << endl;
  dp(1);
  down(1);
  for (int i = 1; i <= n; ++i)
    f[i] = rev[i] ? (K + 1 - f[i]) : f[i], printf("%d ", f[i]);
  puts("");
  return 0;
}