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;
int n;
vector<int> adjList[500000];
pair<int, int> ds[500000], num[500000], temp[500000];
int bad = 0;
pair<int, int> find(int n) {
  if (ds[n].first != n) {
    pair<int, int> p = find(ds[n].first);
    ds[n] = make_pair(p.first, p.second ^ ds[n].second);
  }
  return ds[n];
}
int merge(int a, int b, int e) {
  pair<int, int> pa = find(a), push_back = find(b);
  e ^= pa.second ^ push_back.second;
  if (pa.first == push_back.first) {
    if (e) bad = 1;
    return 0;
  }
  ds[pa.first] = make_pair(push_back.first, e);
  return 0;
}
int parent[500000][19], toUpdate[500000][19], depth[500000];
int doDFS(int u, int p, int d) {
  int i;
  parent[u][0] = p, depth[u] = d;
  for (i = 0; i < adjList[u].size(); i++) {
    int v = adjList[u][i];
    if (v != p) doDFS(v, u, d + 1);
  }
  return 0;
}
int ans, dp[500000];
int doDFS2(int u) {
  int i;
  vector<pair<int, int> > c;
  for (i = 0; i < adjList[u].size(); i++) {
    int v = adjList[u][i];
    if (v != parent[u][0]) {
      doDFS2(v);
      if (dp[v] == 1e9) {
        dp[u] = 1e9;
        return 0;
      } else
        c.push_back(make_pair(dp[v], v));
    }
  }
  if (!c.empty()) swap(*max_element(c.begin(), c.end()), c[0]);
  for (i = 0; i < c.size(); i++) num[find(c[i].second).first] = make_pair(0, 0);
  for (i = 1; i < c.size(); i++) {
    if (c[i].first + c[0].first > ans) {
      pair<int, int> p = find(c[i].second);
      if (p.first == find(c[0].second).first) {
        if (p.second != find(c[0].second).second) {
          dp[u] = 1e9;
          return 0;
        }
      } else {
        if (temp[p.first] == make_pair(u, p.second ^ 1)) {
          dp[u] = 1e9;
          return 0;
        }
        temp[p.first] = make_pair(u, p.second);
      }
    }
  }
  dp[u] = (u != 0);
  pair<int, int> pu = find(u);
  if ((temp[pu.first].first == u) && (pu.first != find(c[0].second).first))
    pu = make_pair(find(c[0].second).first, pu.second ^ temp[pu.first].second ^
                                                find(c[0].second).second);
  for (i = 0; i < c.size(); i++) {
    pair<int, int> p = find(c[i].second);
    if (temp[p.first].first == u)
      p = make_pair(find(c[0].second).first,
                    p.second ^ temp[p.first].second ^ find(c[0].second).second);
    if (p.first == pu.first) {
      if (!(p.second ^ pu.second)) dp[u] = max(dp[u], c[i].first + (u != 0));
    }
    if (p.second)
      num[p.first].second = max(num[p.first].second, c[i].first);
    else
      num[p.first].first = max(num[p.first].first, c[i].first);
    dp[u] = max(dp[u], min(num[p.first].first, num[p.first].second) + (u != 0));
  }
  if (dp[u] > ans) {
    dp[u] = 1e9;
    return 0;
  }
  return 0;
}
vector<int> adjList2[500000];
int doDFS3(int u, int f) {
  int i;
  vector<pair<int, int> > c;
  if (u != 0) {
    if (f)
      adjList2[parent[u][0]].push_back(u);
    else
      adjList2[u].push_back(parent[u][0]);
  }
  for (i = 0; i < adjList[u].size(); i++) {
    int v = adjList[u][i];
    if (v != parent[u][0]) c.push_back(make_pair(dp[v], v));
  }
  if (!c.empty()) swap(*max_element(c.begin(), c.end()), c[0]);
  for (i = 0; i < c.size(); i++) num[find(c[i].second).first] = make_pair(0, 0);
  for (i = 1; i < c.size(); i++) {
    if (c[i].first + c[0].first > ans) {
      pair<int, int> p = find(c[i].second);
      if (p.first != find(c[0].second).first)
        temp[p.first] = make_pair(u, p.second);
    }
  }
  pair<int, int> pu = find(u);
  if ((temp[pu.first].first == u) && (pu.first != find(c[0].second).first))
    pu = make_pair(find(c[0].second).first, pu.second ^ temp[pu.first].second ^
                                                find(c[0].second).second);
  for (i = 0; i < c.size(); i++) {
    pair<int, int> p = find(c[i].second);
    if (temp[p.first].first == u)
      p = make_pair(find(c[0].second).first,
                    p.second ^ temp[p.first].second ^ find(c[0].second).second);
    if (p.second)
      num[p.first].second = max(num[p.first].second, c[i].first);
    else
      num[p.first].first = max(num[p.first].first, c[i].first);
  }
  for (i = 0; i < c.size(); i++) {
    pair<int, int> p = find(c[i].second);
    if (temp[p.first].first == u)
      p = make_pair(find(c[0].second).first,
                    p.second ^ temp[p.first].second ^ find(c[0].second).second);
    if (p.first == pu.first)
      c[i].first = f ^ p.second ^ pu.second;
    else if (num[p.first].first < num[p.first].second)
      c[i].first = f ^ p.second;
    else
      c[i].first = f ^ p.second ^ 1;
  }
  for (i = 0; i < c.size(); i++) doDFS3(c[i].second, c[i].first);
  return 0;
}
queue<int> Q;
int in[500000], c[500000];
int main() {
  int i, j;
  int m, u, v;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n - 1; i++) {
    scanf("%d %d", &u, &v);
    u--, v--;
    adjList[u].push_back(v);
    adjList[v].push_back(u);
  }
  for (i = 0; i < n; i++) ds[i] = make_pair(i, 0);
  doDFS(0, -1, 0);
  for (i = 1; (1 << i) < n; i++) {
    for (j = 0; j < n; j++) {
      if (parent[j][i - 1] != -1)
        parent[j][i] = parent[parent[j][i - 1]][i - 1];
      else
        parent[j][i] = -1;
    }
  }
  int logn = i;
  for (i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    u--, v--;
    if (depth[u] < depth[v]) swap(u, v);
    for (j = logn - 1; j >= 0; j--) {
      if ((parent[u][j] != -1) && (depth[parent[u][j]] >= depth[v]) &&
          (parent[u][j] != v)) {
        toUpdate[u][j] = 1;
        u = parent[u][j];
      }
    }
    if (parent[u][0] != v) {
      for (j = logn - 1; j >= 0; j--) {
        if (parent[u][j] != parent[v][j]) {
          toUpdate[u][j] = toUpdate[v][j] = 1;
          u = parent[u][j], v = parent[v][j];
        }
      }
      merge(u, v, 1);
    }
  }
  for (i = logn - 1; i > 0; i--) {
    for (j = 0; j < n; j++) {
      if (toUpdate[j][i])
        toUpdate[j][i - 1] = toUpdate[parent[j][i - 1]][i - 1] = 1;
    }
  }
  for (i = 0; i < n; i++) {
    if (toUpdate[i][0]) merge(i, parent[i][0], 0);
  }
  if (bad) {
    printf("-1\n");
    return 0;
  }
  int l = 0, r = n - 1;
  while (l < r) {
    int m = (l + r) / 2;
    if ((l == 0) && (r == n - 1)) m = n - sqrt(n) - 1;
    ans = m;
    fill(temp, temp + n, make_pair(-1, -1));
    doDFS2(0);
    if (dp[0] < 1e9)
      r = m;
    else
      l = m + 1;
  }
  ans = l;
  printf("%d\n", l + 1);
  fill(temp, temp + n, make_pair(-1, -1));
  doDFS2(0);
  fill(temp, temp + n, make_pair(-1, -1));
  doDFS3(0, 0);
  for (i = 0; i < n; i++) {
    for (j = 0; j < adjList2[i].size(); j++) in[adjList2[i][j]]++;
  }
  for (i = 0; i < n; i++) {
    if (in[i] == 0) Q.push(i), c[i] = 1;
  }
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (i = 0; i < adjList2[u].size(); i++) {
      int v = adjList2[u][i];
      in[v]--;
      if (in[v] == 0) c[v] = c[u] + 1, Q.push(v);
    }
  }
  for (i = 0; i < n; i++) printf("%d ", c[i]);
  printf("\n");
  return 0;
}