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 + 5;
vector<int> g[N], id[N];
int n, m;
struct UST {
  vector<int> fa, c;
  inline void init(int n) {
    fa.resize(n + 1);
    c.resize(n + 1);
    for (int i = 0; i <= n; i++) fa[i] = i;
  }
  inline int find(int x) {
    if (fa[x] == x)
      return x;
    else {
      find(fa[x]);
      c[x] ^= c[fa[x]];
      fa[x] = fa[fa[x]];
      return fa[x];
    }
  }
  inline void mrg(int x, int y) {
    find(x), find(y);
    if (fa[x] ^ fa[y]) {
      c[fa[x]] = 1 ^ c[x] ^ c[y];
      fa[fa[x]] = fa[y];
    } else if (c[x] == c[y]) {
      puts("-1");
      exit(0);
    }
  }
} us[N];
int p[N];
int p2[N];
int dep[N], anc[N][20];
inline void adde(int u, int v) {
  g[u].push_back(v);
  id[u].push_back(-1);
}
inline void dfs(int x, int pre) {
  anc[x][0] = pre;
  dep[x] = dep[pre] + 1;
  for (int i = 1; i <= 19; i++) anc[x][i] = anc[anc[x][i - 1]][i - 1];
  us[x].init(g[x].size());
  for (size_t i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    if (v == pre) continue;
    dfs(v, x);
  }
}
vector<pair<int, int> > opts[N];
inline void perform(int x, int y) {
  if (x == y) return;
  if (dep[x] < dep[y]) swap(x, y);
  int _x = x;
  p2[x]++, p2[y]++;
  for (int i = 19; ~i; i--)
    if (dep[anc[x][i]] >= dep[y]) x = anc[x][i];
  if (x != y) {
    p[_x]++, p[y]++;
    for (int i = 19; ~i; i--) {
      if (anc[x][i] != anc[y][i]) x = anc[x][i], y = anc[y][i];
    }
    p[x]--, p[y]--;
    opts[anc[x][0]].push_back(pair<int, int>(x, y));
    p2[anc[x][0]] -= 2;
  } else {
    x = _x;
    p[x]++;
    for (int i = 19; ~i; i--)
      if (dep[anc[x][i]] > dep[y]) x = anc[x][i];
    p[x]--;
    p2[y] -= 2;
  }
}
int K;
bool FLAG;
int f[N], temp_id[N];
vector<int> h[N][2];
inline void pref(int x, int pre) {
  for (int j = 0; j < 2; j++) h[x][j].resize(g[x].size());
  for (size_t i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    if (v == pre) continue;
    pref(v, x);
    p[x] += p[v];
    p2[x] += p2[v];
  }
  for (size_t i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    if (v == pre && p2[x])
      id[x][i] = i;
    else if (p2[v])
      id[x][i] = i;
  }
  for (size_t i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    temp_id[v] = id[x][i];
  }
  for (size_t i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    if (v != pre && p[v]) {
      us[x].mrg(temp_id[v], temp_id[pre]);
    }
  }
  for (size_t i = 0; i < opts[x].size(); i++) {
    int a = opts[x][i].first, b = opts[x][i].second;
    us[x].mrg(temp_id[a], temp_id[b]);
  }
  for (size_t i = 0; i < g[x].size(); i++) {
    if (id[x][i] != -1) {
      us[x].find(id[x][i]);
    }
  }
}
int dir[N];
inline void Dp(int x, int pre) {
  f[x] = 1;
  for (int i = 0; i < (int)g[x].size(); i++) h[x][0][i] = h[x][1][i] = 0;
  int qwq[2] = {0, 0};
  int idd = -1, cidd = 0;
  for (size_t i = 0; i < g[x].size(); i++) {
    if (g[x][i] == pre) {
      if (id[x][i] != -1) idd = us[x].fa[id[x][i]], cidd = us[x].c[id[x][i]];
    }
  }
  for (size_t i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    if (v == pre) continue;
    Dp(v, x);
    if (id[x][i] != -1) {
      if (us[x].fa[id[x][i]] == idd) {
        dir[v] = (us[x].c[id[x][i]] == cidd);
        if (us[x].c[id[x][i]] != cidd)
          qwq[0] = max(qwq[0], f[v]);
        else
          qwq[1] = max(qwq[1], f[v]);
      } else {
        h[x][us[x].c[id[x][i]]][us[x].fa[id[x][i]]] =
            max(h[x][us[x].c[id[x][i]]][us[x].fa[id[x][i]]], f[v]);
      }
    }
  }
  int qaq[2] = {0, 0};
  for (size_t i = 0; i < g[x].size(); i++) {
    int a = min(h[x][0][i], h[x][1][i]), b = max(h[x][0][i], h[x][1][i]);
    qaq[0] = max(qaq[0], a);
    qaq[1] = max(qaq[1], b);
  }
  int type = 0;
  if (max(qaq[0], qwq[0]) + max(qwq[1], qaq[1]) < K) {
    f[x] = max(qaq[0], qwq[0]) + 1;
  } else {
    type = 1;
    if (max(qaq[1], qwq[0]) + max(qwq[1], qaq[0]) < K)
      f[x] = max(qaq[1], qwq[0]) + 1;
    else
      FLAG = 0, f[x] = 1;
  }
  for (size_t i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    if (v == pre) continue;
    if (id[x][i] != -1) {
      if (us[x].fa[id[x][i]] == idd) continue;
      int idx = us[x].fa[id[x][i]], c = us[x].c[id[x][i]];
      int cc = c ^ (h[x][0][idx] > h[x][1][idx]) ^ type;
      dir[v] = cc;
    }
  }
}
inline bool check(int k) {
  K = k, FLAG = 1;
  Dp(1, 0);
  return FLAG;
}
bool t[N];
int ans[N];
inline void getans(int x, int pre) {
  ans[x] = t[x] ? K + 1 - f[x] : f[x];
  for (size_t i = 0; i < g[x].size(); i++) {
    if (g[x][i] == pre) continue;
    t[g[x][i]] = t[x] ^ dir[g[x][i]];
    getans(g[x][i], x);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adde(u, v), adde(v, u);
  }
  dfs(1, 0);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    perform(u, v);
  }
  pref(1, 0);
  int l = 1, r = n;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l << endl;
  check(l);
  getans(1, 0);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  puts("");
  return 0;
}