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 = 500005;
int n, m;
vector<int> e[N];
namespace DSU {
int fa[N], v[N];
int get(int x) {
  if (x == fa[x]) return x;
  int f = fa[x];
  fa[x] = get(fa[x]);
  v[x] ^= v[f];
  return fa[x];
}
void build() {
  for (int i = (int)(1); i <= (int)(n); i++) fa[i] = i, v[i] = 0;
}
void merge(int x, int y, int vv) {
  int px = get(x), py = get(y);
  if (px == py) {
    if (v[x] ^ v[y] ^ vv) {
      puts("-1");
      exit(0);
    }
  } else {
    fa[px] = py;
    v[px] = v[x] ^ v[y] ^ vv;
  }
}
}  // namespace DSU
namespace TR {
int S[N], SS[N];
int fa[N], sz[N], dep[N];
int pos[N], dfn[N], top[N];
void dfs1(int x) {
  sz[x] = 1;
  for (auto i : e[x])
    if (i != fa[x]) {
      fa[i] = x;
      dep[i] = dep[x] + 1;
      dfs1(i);
      sz[x] += sz[i];
    }
}
void dfs2(int x, int tp) {
  dfn[x] = ++*dfn;
  pos[*dfn] = x;
  top[x] = tp;
  int k = 0;
  for (auto i : e[x])
    if (i != fa[x] && sz[i] > sz[k]) k = i;
  if (k) dfs2(k, tp);
  for (auto i : e[x])
    if (i != fa[x] && i != k) dfs2(i, i);
}
int LCA(int x, int y) {
  for (; top[x] != top[y]; x = fa[top[x]])
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
  return dep[x] < dep[y] ? x : y;
}
int jmp(int x, int y) {
  for (;;) {
    if (dep[top[x]] <= dep[y]) return pos[dfn[y] + 1];
    if (dep[top[x]] == dep[y] + 1) return top[x];
    x = fa[top[x]];
  }
}
void build() {
  dfs1(1);
  dfs2(1, 1);
}
void build2() {
  for (int i = (int)(n); i >= (int)(1); i--) {
    int x = pos[i];
    S[fa[x]] += S[x];
    SS[fa[x]] += SS[x];
    if (SS[x]) DSU::merge(x, fa[x], 0);
  }
}
void insert_que(int x, int y) {
  int L = LCA(x, y);
  S[x]++;
  S[y]++;
  S[L] -= 2;
  if (dep[x] ^ dep[L]) SS[x]++, SS[x = jmp(x, L)]--;
  if (dep[y] ^ dep[L]) SS[y]++, SS[y = jmp(y, L)]--;
  if ((x ^ L) && (y ^ L)) DSU::merge(x, y, 1);
}
}  // namespace TR
int v0[N], v1[N];
int vis[N], f[N], T;
int cc[N], fl[N];
bool check(int K) {
  static int q[N];
  for (int i = (int)(n); i >= (int)(1); i--) {
    int x = TR::pos[i], y = TR::fa[x];
    int vl = 0, vr = 0;
    ++T;
    *q = 0;
    for (auto j : e[x])
      if (j != y && TR::S[j]) {
        int c = DSU::fa[j];
        if (vis[c] != T) vis[c] = T, q[++*q] = c, v0[c] = v1[c] = 0;
        if (DSU::v[j] == 0)
          v0[c] = max(v0[c], f[j]);
        else
          v1[c] = max(v1[c], f[j]);
      }
    if (vis[DSU::fa[x]] == T) {
      int c = DSU::fa[x];
      vl = v0[c];
      vr = v1[c];
      if (DSU::v[x]) swap(vl, vr);
    }
    int vmn = 0, vmx = 0;
    for (int j = (int)(1); j <= (int)(*q); j++)
      if (q[j] != DSU::fa[x]) {
        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;
    f[x] = (max(vmn, vl) + max(vmx, vr) >= K ? max(vmx, vl) : max(vmn, vl)) + 1;
  }
  return 1;
}
void construct(int K) {
  static int q[N];
  for (int i = (int)(1); i <= (int)(n); i++) {
    int x = TR::pos[i], y = TR::fa[x];
    ++T;
    *q = 0;
    for (auto j : e[x])
      if (j != y && TR::S[j]) {
        int c = DSU::fa[j];
        if (vis[c] != T) vis[c] = T, q[++*q] = c, v0[c] = v1[c] = 0;
        if (DSU::v[j] == 0)
          v0[c] = max(v0[c], f[j]);
        else
          v1[c] = max(v1[c], f[j]);
      }
    for (int j = (int)(1); j <= (int)(*q); j++) {
      cc[q[j]] = fl[x];
      if (q[j] != DSU::fa[x])
        cc[q[j]] ^= (v0[q[j]] > f[x] - 1 || v1[q[j]] + f[x] > K);
      else
        cc[q[j]] ^= DSU::v[x];
    }
    for (auto j : e[x])
      if (j != y && TR::S[j]) fl[j] = cc[DSU::fa[j]] ^ DSU::v[j];
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(n - 1); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  TR::build();
  DSU::build();
  for (int i = (int)(1); i <= (int)(m); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    TR::insert_que(x, y);
  }
  TR::build2();
  for (int i = (int)(1); i <= (int)(n); i++) DSU::get(i);
  int l = 1, r = n, ans = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%d\n", ans);
  check(ans);
  construct(ans);
  static int v[N];
  for (int i = (int)(1); i <= (int)(n); i++)
    printf("%d ", v[i] = (!fl[i] ? f[i] : ans + 1 - f[i]));
  cout << endl;
  for (int i = (int)(2); i <= (int)(n); i++)
    assert(fl[i] ^ DSU::v[i] ^ fl[DSU::fa[i]] ^ 1);
}