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;
inline pair<int, int> merge(pair<int, int> x, pair<int, int> y) {
  return pair<int, int>(max(x.first, y.first), min(x.second, y.second));
}
vector<int> e[500005];
int fa[500005][20], dep[500005];
void dfs1(int x) {
  for (int i = 0; i < e[x].size(); i++)
    if (e[x][i] != fa[x][0]) {
      int u = e[x][i];
      fa[u][0] = x;
      dep[u] = dep[x] + 1;
      for (int j = 1; j < 20; j++) fa[u][j] = fa[fa[u][j - 1]][j - 1];
      dfs1(u);
    }
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  int d = dep[x] - dep[y];
  for (int i = 0; i < 20; i++)
    if ((d >> i) & 1) x = fa[x][i];
  if (x == y) return x;
  for (int i = 19; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) {
      x = fa[x][i];
      y = fa[y][i];
    }
  return fa[x][0];
}
int jump(int x, int d) {
  for (int i = 0; i < 20; i++)
    if ((d >> i) & 1) x = fa[x][i];
  return x;
}
vector<pair<int, int> > ee[500005];
int size[500005];
void dfs2(int x, int fa) {
  for (int i = 0; i < e[x].size(); i++)
    if (e[x][i] != fa) {
      int u = e[x][i];
      dfs2(u, x);
      size[x] += size[u];
    }
  if (size[x]) {
    ee[x].push_back(pair<int, int>(fa, 0));
    ee[fa].push_back(pair<int, int>(x, 0));
  }
}
int col[500005], id[500005];
void dfs3(int x) {
  for (int i = 0; i < ee[x].size(); i++) {
    int u = ee[x][i].first;
    if (!id[u]) {
      id[u] = id[x];
      col[u] = col[x] ^ ee[x][i].second;
      dfs3(u);
    } else if ((col[x] ^ col[u]) != ee[x][i].second) {
      puts("-1");
      exit(0);
    }
  }
}
pair<int, int> f[500005], g[500005];
int vis[500005];
bool dfs4(int x, int fa, int k) {
  for (int i = 0; i < e[x].size(); i++)
    if (e[x][i] != fa) {
      int u = e[x][i];
      if (!dfs4(u, x, k)) return 0;
    }
  f[x] = pair<int, int>(1, k);
  int sz = 0;
  for (int i = 0; i < e[x].size(); i++)
    if (e[x][i] != fa && id[e[x][i]]) {
      int u = e[x][i];
      if (id[u] == id[x]) {
        if (!col[u])
          f[x] = merge(f[x], pair<int, int>(1, f[u].second - 1));
        else
          f[x] = merge(f[x], pair<int, int>(f[u].first + 1, k));
      } else {
        if (!vis[id[u]]) {
          vis[id[u]] = ++sz;
          g[sz] = pair<int, int>(1, k);
        }
        int t = vis[id[u]];
        if (!col[u])
          g[t] = merge(g[t], pair<int, int>(1, f[u].second - 1));
        else
          g[t] = merge(g[t], pair<int, int>(f[u].first + 1, k));
      }
    }
  for (int i = 0; i < e[x].size(); i++)
    if (e[x][i] != fa) vis[id[e[x][i]]] = 0;
  if (f[x].first > f[x].second) return 0;
  pair<int, int> u(1, k);
  for (int i = 1; i <= sz; i++) {
    if (g[i].first > g[i].second) return 0;
    if (k - g[i].second + 1 < g[i].first)
      g[i] = pair<int, int>(k - g[i].second + 1, k - g[i].first + 1);
    u = merge(u, g[i]);
  }
  pair<int, int> t1 = merge(u, f[x]),
                 t2 = merge(pair<int, int>(k - u.second + 1, k - u.first + 1),
                            f[x]);
  if (t1.first > t1.second && t2.first > t2.second) return 0;
  if (t1.first > t1.second)
    f[x] = t2;
  else if (t2.first > t2.second)
    f[x] = t1;
  else
    f[x] = pair<int, int>(min(t1.first, t2.first), max(t1.second, t2.second));
  return 1;
}
int ans[500005], val[500005];
bool d[500005];
void dfs5(int x, int fa, int k, bool v) {
  int sz = 0;
  for (int i = 0; i < e[x].size(); i++)
    if (e[x][i] != fa && id[e[x][i]] != id[x]) {
      int u = e[x][i];
      if (!vis[id[u]]) {
        vis[id[u]] = ++sz;
        val[sz] = id[u];
        g[sz] = pair<int, int>(1, k);
      }
      int t = vis[id[u]];
      if (!col[u])
        g[t] = merge(g[t], pair<int, int>(1, f[u].second - 1));
      else
        g[t] = merge(g[t], pair<int, int>(f[u].first + 1, k));
    }
  for (int i = 0; i < e[x].size(); i++)
    if (e[x][i] != fa) vis[id[e[x][i]]] = 0;
  for (int i = 1; i <= sz; i++)
    d[val[i]] = ((g[i].first <= ans[x] && g[i].second >= ans[x]) ? 0 : 1);
  for (int i = 0; i < e[x].size(); i++)
    if (e[x][i] != fa) {
      int u = e[x][i];
      if (!id[u]) {
        ans[u] = f[u].first;
        dfs5(u, x, k, 0);
      } else {
        bool c = ((id[u] == id[x]) ? v : d[id[u]]);
        if (!c)
          ans[u] = ((!col[u]) ? f[u].second : f[u].first);
        else
          ans[u] = ((col[u]) ? k - f[u].first + 1 : k - f[u].second + 1);
        dfs5(u, x, k, c);
      }
    }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  dfs1(1);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    int p = lca(x, y), u, v;
    if (p != x) {
      size[x]++;
      size[u = jump(x, dep[x] - dep[p] - 1)]--;
    }
    if (p != y) {
      size[y]++;
      size[v = jump(y, dep[y] - dep[p] - 1)]--;
    }
    if (p != x && p != y) {
      ee[u].push_back(pair<int, int>(v, 1));
      ee[v].push_back(pair<int, int>(u, 1));
    }
  }
  dfs2(1, 0);
  int cnt = 0;
  for (int i = 2; i <= n; i++)
    if (!id[i]) {
      id[i] = ++cnt;
      dfs3(i);
    }
  int l = 1, r = n;
  while (l < r) {
    int mid = ((l + r) >> 1);
    bool v = dfs4(1, 0, mid);
    if (v)
      r = mid;
    else
      l = mid + 1;
  }
  dfs4(1, 0, l);
  ans[1] = f[1].first;
  dfs5(1, 0, l, 0);
  printf("%d\n", l);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}