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 MOD = 1e9 + 7;
const int MX = 5e5 + 5;
const long long INF = 1e18;
const long double PI = acos((long double)-1);
const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
int pct(int x) { return __builtin_popcount(x); }
int bit(int x) { return 31 - __builtin_clz(x); }
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
namespace input {
template <class T>
void re(complex<T>& x);
template <class T1, class T2>
void re(pair<T1, T2>& p);
template <class T>
void re(vector<T>& a);
template <class T, size_t SZ>
void re(array<T, SZ>& a);
template <class T>
void re(T& x) {
  cin >> x;
}
void re(double& x) {
  string t;
  re(t);
  x = stod(t);
}
void re(long double& x) {
  string t;
  re(t);
  x = stold(t);
}
template <class T, class... Ts>
void re(T& t, Ts&... ts) {
  re(t);
  re(ts...);
}
template <class T>
void re(complex<T>& x) {
  T a, b;
  re(a, b);
  x = {a, b};
}
template <class T1, class T2>
void re(pair<T1, T2>& p) {
  re(p.first, p.second);
}
template <class T>
void re(vector<T>& a) {
  for (int i = (0); i < ((int)a.size()); ++i) re(a[i]);
}
template <class T, size_t SZ>
void re(array<T, SZ>& a) {
  for (int i = (0); i < (SZ); ++i) re(a[i]);
}
}  // namespace input
using namespace input;
namespace output {
void pr(int x) { cout << x; }
void pr(long x) { cout << x; }
void pr(long long x) { cout << x; }
void pr(unsigned x) { cout << x; }
void pr(unsigned long x) { cout << x; }
void pr(unsigned long long x) { cout << x; }
void pr(float x) { cout << x; }
void pr(double x) { cout << x; }
void pr(long double x) { cout << x; }
void pr(char x) { cout << x; }
void pr(const char* x) { cout << x; }
void pr(const string& x) { cout << x; }
void pr(bool x) { pr(x ? "true" : "false"); }
template <class T>
void pr(const complex<T>& x) {
  cout << x;
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x);
template <class T>
void pr(const T& x);
template <class T, class... Ts>
void pr(const T& t, const Ts&... ts) {
  pr(t);
  pr(ts...);
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x) {
  pr("{", x.first, ", ", x.second, "}");
}
template <class T>
void pr(const T& x) {
  pr("{");
  bool fst = 1;
  for (const auto& a : x) pr(!fst ? ", " : "", a), fst = 0;
  pr("}");
}
void ps() { pr("\n"); }
template <class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pr(" ");
  ps(ts...);
}
void pc() { pr("]\n"); }
template <class T, class... Ts>
void pc(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pr(", ");
  pc(ts...);
}
}  // namespace output
using namespace output;
namespace io {
void setIn(string second) { freopen(second.c_str(), "r", stdin); }
void setOut(string second) { freopen(second.c_str(), "w", stdout); }
void setIO(string second = "") {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if ((int)second.size()) {
    setIn(second + ".in"), setOut(second + ".out");
  }
}
}  // namespace io
using namespace io;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
struct DSU {
  vector<pair<int, int> > par;
  void init(int n) {
    par.resize(n);
    for (int i = (0); i < (n); ++i) par[i] = {i, 0};
  }
  pair<int, int> get(int x) {
    if (par[x].first == x) return par[x];
    pair<int, int> p = get(par[x].first);
    p.second ^= par[x].second;
    return par[x] = p;
  }
  void unite(int x, int y, int z) {
    pair<int, int> X = get(x), Y = get(y);
    if (X.first == Y.first) {
      if ((X.second ^ Y.second) != z) {
        ps(-1);
        exit(0);
      }
    } else {
      par[Y.first] = {X.first, X.second ^ Y.second ^ z};
    }
  }
};
template <int SZ>
struct LCA {
  static const int BITS = 32 - __builtin_clz(SZ);
  int N, R = 1, par[BITS][SZ], depth[SZ];
  vector<int> adj[SZ];
  void ae(int u, int v) { adj[u].push_back(v), adj[v].push_back(u); }
  void dfs(int u, int prev) {
    par[0][u] = prev;
    depth[u] = depth[prev] + 1;
    for (auto& v : adj[u])
      if (v != prev) dfs(v, u);
  }
  void init(int _N) {
    N = _N;
    dfs(R, 0);
    for (int k = (1); k < (BITS); ++k)
      for (int i = (1); i < (N + 1); ++i) par[k][i] = par[k - 1][par[k - 1][i]];
  }
  int getPar(int a, int b) {
    for (int k = (BITS)-1; k >= (0); --k)
      if (b & (1 << k)) a = par[k][a];
    return a;
  }
  int lca(int u, int v) {
    if (depth[u] < depth[v]) swap(u, v);
    u = getPar(u, depth[u] - depth[v]);
    for (int k = (BITS)-1; k >= (0); --k)
      if (par[k][u] != par[k][v]) u = par[k][u], v = par[k][v];
    return u == v ? u : par[0][u];
  }
  int dist(int u, int v) { return depth[u] + depth[v] - 2 * depth[lca(u, v)]; }
};
LCA<MX> L;
int n, m, mn[MX], c[MX], mid;
bool bad;
DSU D;
bool par[MX], tmpPar[MX];
pair<int, int> stor[MX];
bool fin;
void dfs(int x) {
  for (auto& t : L.adj[x])
    if (t != L.par[0][x]) {
      dfs(t);
      if (bad) return;
    }
  for (auto& t : L.adj[x])
    if (t != L.par[0][x]) {
      stor[D.get(t).first].first = MOD;
    }
  pair<int, int> p = D.get(x);
  stor[p.first] = {1, mid};
  vector<int> todo = {p.first};
  for (auto& t : L.adj[x])
    if (t != L.par[0][x]) {
      pair<int, int> p = D.get(t);
      if (stor[p.first].first == MOD) {
        stor[p.first] = {1, mid};
        todo.push_back(p.first);
      }
      if (p.second == 0)
        ckmax(stor[p.first].first, mn[t] + 1);
      else
        ckmin(stor[p.first].second, mid - mn[t]);
    }
  pair<int, int> P = stor[p.first];
  if (p.second) P = {mid + 1 - P.second, mid + 1 - P.first};
  pair<int, int> ban = {MOD, -MOD};
  int LL = P.first, RR = P.second;
  for (int i = (1); i < ((int)todo.size()); ++i) {
    pair<int, int> z = stor[todo[i]];
    if (z.first > z.second) {
      bad = 1;
      return;
    }
    pair<int, int> Z = {mid + 1 - z.second, mid + 1 - z.first};
    if (z > Z) swap(z, Z);
    ckmax(LL, z.first), ckmin(RR, Z.second);
    if (z.second + 1 < Z.first) {
      ckmin(ban.first, z.second + 1), ckmax(ban.second, Z.first - 1);
    }
  }
  if (LL > RR) {
    bad = 1;
    return;
  }
  int val;
  if (LL < ban.first)
    val = LL;
  else if (LL > ban.second)
    val = LL;
  else if (ban.second < RR)
    val = ban.second + 1;
  else {
    bad = 1;
    return;
  }
  mn[x] = val;
  tmpPar[p.first] = p.second;
  for (int i = (1); i < ((int)todo.size()); ++i) {
    pair<int, int> t = stor[todo[i]];
    if (t.first <= val && val <= t.second) {
      tmpPar[todo[i]] = 0;
    } else {
      tmpPar[todo[i]] = 1;
    }
  }
  if (fin) {
    for (auto& t : L.adj[x])
      if (t != L.par[0][x]) {
        pair<int, int> p = D.get(t);
        par[t] = tmpPar[p.first] ^ p.second;
      }
  }
}
bool ok() {
  bad = 0;
  dfs(1);
  return !bad;
}
void genAns(int x) {
  if (par[x] == 0) {
    c[x] = mn[x];
  } else {
    c[x] = mid + 1 - mn[x];
  }
  for (auto& t : L.adj[x])
    if (t != L.par[0][x]) {
      par[t] ^= par[x];
      genAns(t);
    }
}
int ad[MX];
void path(int a, int b) {
  int x = L.lca(a, b);
  int A, B;
  if (a != x) {
    A = L.getPar(a, L.depth[a] - L.depth[x] - 1);
    ad[a]++;
    ad[A]--;
  }
  if (b != x) {
    B = L.getPar(b, L.depth[b] - L.depth[x] - 1);
    ad[b]++;
    ad[B]--;
  }
  if (a != x && b != x) {
    D.unite(A, B, 1);
  }
}
void genAd(int x) {
  for (auto& t : L.adj[x])
    if (t != L.par[0][x]) {
      genAd(t);
      ad[x] += ad[t];
    }
  if (ad[x]) {
    D.unite(x, L.par[0][x], 0);
  }
}
namespace FastIO {
const int BSZ = 1 << 15;
char ibuf[BSZ];
int ipos, ilen;
char nc() {
  if (ipos == ilen) {
    ipos = 0;
    ilen = fread(ibuf, 1, BSZ, stdin);
    if (!ilen) return EOF;
  }
  return ibuf[ipos++];
}
void rs(string& x) {
  char ch;
  while (isspace(ch = nc()))
    ;
  do {
    x += ch;
  } while (!isspace(ch = nc()) && ch != EOF);
}
template <class T>
void ri(T& x) {
  char ch;
  int sgn = 1;
  while (!isdigit(ch = nc()))
    if (ch == '-') sgn *= -1;
  x = ch - '0';
  while (isdigit(ch = nc())) x = x * 10 + (ch - '0');
  x *= sgn;
}
template <class T, class... Ts>
void ri(T& t, Ts&... ts) {
  ri(t);
  ri(ts...);
}
char obuf[BSZ], numBuf[100];
int opos;
void flushOut() {
  fwrite(obuf, 1, opos, stdout);
  opos = 0;
}
void wc(char c) {
  if (opos == BSZ) flushOut();
  obuf[opos++] = c;
}
void ws(string second) {
  for (auto& c : second) wc(c);
}
template <class T>
void wi(T x, char after = '\0') {
  if (x < 0) wc('-'), x *= -1;
  int len = 0;
  for (; x >= 10; x /= 10) numBuf[len++] = '0' + (x % 10);
  wc('0' + x);
  for (int i = (len)-1; i >= (0); --i) wc(numBuf[i]);
  if (after) wc(after);
}
void initO() { assert(atexit(flushOut) == 0); }
}  // namespace FastIO
using namespace FastIO;
void init() {
  initO();
  ri(n, m);
  D.init(n + 1);
  for (int i = (0); i < (n - 1); ++i) {
    int a, b;
    ri(a, b);
    L.ae(a, b);
  }
  L.init(n);
  for (int i = (0); i < (m); ++i) {
    int a, b;
    ri(a, b);
    path(a, b);
  }
  genAd(1);
}
int main() {
  init();
  mid = n;
  int lo = 1, hi = n;
  while (lo < hi) {
    mid = (lo + hi) / 2;
    if (ok())
      hi = mid;
    else
      lo = mid + 1;
  }
  mid = lo;
  fin = 1;
  assert(ok());
  ps(mid);
  genAns(1);
  for (int i = (1); i < (n + 1); ++i) {
    if (i < n)
      wi(c[i], ' ');
    else
      wi(c[i], '\n');
  }
}