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> v[N], v1[N], v2[N];
int dep[N], fa[N], dp[N][20], mp[N], didx;
int ff[N * 2];
int getf(int v) { return ff[v] == v ? v : ff[v] = getf(ff[v]); }
inline void merge(int x, int y) { ff[getf(x)] = getf(y); }
void dfs(int pos, int f) {
  mp[++didx] = pos;
  dep[pos] = dep[f] + 1;
  fa[pos] = dp[pos][0] = f;
  if (f > 0) v[pos].erase(find(v[pos].begin(), v[pos].end(), f));
  for (auto &i : v[pos]) dfs(i, pos);
}
int tg[N], tg2[N];
void dfs2(int pos, int f) {
  for (auto &i : v[pos]) dfs2(i, pos), tg[pos] += tg[i], tg2[pos] += tg2[i];
  if (tg[pos]) merge(pos, f), merge(pos + n, f + n);
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 19; i >= 0; --i)
    if (dep[dp[x][i]] >= dep[y]) x = dp[x][i];
  if (x == y) return x;
  for (int i = 19; i >= 0; --i)
    if (dp[x][i] != dp[y][i]) x = dp[x][i], y = dp[y][i];
  return dp[x][0];
}
int lift(int pos, int kk) {
  for (int i = 19; i >= 0; --i)
    if ((kk >> i) & 1) pos = dp[pos][i];
  return pos;
}
int f[N];
bool rev[N];
struct Seg {
  int l, r;
};
inline Seg operator&(const Seg &a, const Seg &b) {
  return {max(a.l, b.l), min(a.r, b.r)};
}
inline Seg operator|(const Seg &a, const Seg &b) {
  return {min(a.l, b.l), max(a.r, b.r)};
}
inline bool chk(Seg x) { return x.l > x.r; }
bool check(int mid) {
  Seg aa = {0, mid};
  for (int i = n; i > 0; --i) {
    int x = mp[i];
    Seg s = aa;
    for (auto &j : v2[x])
      s = s &
          (getf(x) == getf(j) ? Seg{f[j] + 1, mid} : Seg{0, mid - f[j] - 1}),
      rev[j] = getf(j) == getf(x + n);
    Seg s1 = s, s2 = {mid, 0}, s3;
    for (int j = 0, k; j < int(v[x].size()); j = k) {
      s3 = aa;
      int y = v[x][j];
      for (k = j; k < int(v[x].size()); k++) {
        int z = v[x][k];
        if (!(getf(z) == getf(y) || getf(z) == getf(y + n))) break;
        s3 = s3 &
             (getf(y) == getf(z) ? Seg{f[z] + 1, mid} : Seg{0, mid - f[z] - 1});
      }
      if (chk(s3)) return 0;
      if (s3.l > mid - s3.l) s3 = {mid - s3.r, mid - s3.l};
      s1 = s1 & (Seg{s3.l, mid - s3.l} | Seg{mid - s3.r, s3.r});
      if (s3.r < mid - s3.r) s2 = s2 | Seg{s3.r + 1, mid - s3.r - 1};
    }
    if (chk(s1) || (s2.l <= s1.l && s1.r <= s2.r)) return 0;
    if (s2.l <= s1.l && s1.l <= s2.r)
      f[x] = s2.r + 1;
    else
      f[x] = s1.l;
    for (int j = 0, k; j < int(v[x].size()); j = k) {
      s3 = aa;
      int y = v[x][j];
      for (k = j; k < int(v[x].size()); k++) {
        int z = v[x][k];
        if (!(getf(z) == getf(y) || getf(z) == getf(y + n))) break;
        s3 = s3 &
             (getf(y) == getf(z) ? Seg{f[z] + 1, mid} : Seg{0, mid - f[z] - 1});
      }
      bool fl = 0;
      int z = 0;
      if (f[x] < s3.l || f[x] > s3.r) fl = 1, s3 = {mid - s3.r, mid - s3.l};
      for (int l = j; l < k; l++)
        z = v[x][l], rev[z] = (getf(z) == getf(y + n)) ^ fl;
    }
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  int t1, t2;
  for (int i = 1; i < n; i++)
    cin >> t1 >> t2, v[t1].push_back(t2), v[t2].push_back(t1);
  dfs(1, 0);
  for (int j = 1; j < 20; j++)
    for (int i = 1; i <= n; i++) dp[i][j] = dp[dp[i][j - 1]][j - 1];
  for (int i = 1; i <= n * 2; i++) ff[i] = i;
  for (int i = 1; i <= m; i++) {
    cin >> t1 >> t2;
    int tt1 = 0, tt2 = 0, z = lca(t1, t2);
    ++tg2[t1];
    ++tg2[t2];
    tg2[z] -= 2;
    if (dep[t2] > dep[z]) ++tg[t2], --tg[tt2 = lift(t2, dep[t2] - dep[z] - 1)];
    if (dep[t1] > dep[z]) ++tg[t1], --tg[tt1 = lift(t1, dep[t1] - dep[z] - 1)];
    if (tt1 && tt2) merge(tt1, tt2 + n), merge(tt1 + n, tt2);
  }
  dfs2(1, 0);
  for (int i = 1; i <= n; i++)
    if (getf(i) == getf(i + n)) {
      cout << -1 << endl;
      return 0;
    }
  int le = 1, ri = n - 1;
  static int w[N];
  for (int i = 2; i <= n; i++) w[i] = min(getf(i), getf(i + n));
  for (int i = 1; i <= n; i++) {
    vector<int> v3;
    for (auto &j : v[i])
      if (w[i] == w[j])
        v2[i].push_back(j);
      else if (tg2[j])
        v3.push_back(j);
    sort(v3.begin(), v3.end(), [](int x, int y) { return w[x] < w[y]; });
    v[i] = v3;
  }
  while (le < ri) {
    int mid = (le + ri) >> 1;
    if (!check(mid))
      le = mid + 1;
    else
      ri = mid;
  }
  cout << le + 1 << endl;
  check(le);
  for (int i = 2; i <= n; i++) {
    int x = mp[i];
    rev[x] ^= rev[fa[x]];
  }
  for (int i = 1; i <= n; i++) cout << (rev[i] ? le - f[i] : f[i]) + 1 << ' ';
  return 0;
}