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;
using ll = long long;
template <class t, class u>
void chmax(t& first, u second) {
  if (first < second) first = second;
}
template <class t, class u>
void chmin(t& first, u second) {
  if (second < first) first = second;
}
template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;
using pi = pair<int, int>;
using vi = vc<int>;
template <class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
  return os << "{" << p.first << "," << p.second << "}";
}
template <class t>
ostream& operator<<(ostream& os, const vc<t>& v) {
  os << "{";
  for (auto e : v) os << e << ",";
  return os << "}";
}
using uint = unsigned;
using ull = unsigned long long;
template <class t, size_t n>
ostream& operator<<(ostream& os, const array<t, n>& first) {
  return os << vc<t>(first.begin(), first.end());
}
template <int i, class T>
void print_tuple(ostream&, const T&) {}
template <int i, class T, class H, class... Args>
void print_tuple(ostream& os, const T& t) {
  if (i) os << ",";
  os << get<i>(t);
  print_tuple<i + 1, T, Args...>(os, t);
}
template <class... Args>
ostream& operator<<(ostream& os, const tuple<Args...>& t) {
  os << "{";
  print_tuple<0, tuple<Args...>, Args...>(os, t);
  return os << "}";
}
template <class t>
void print(t x, int suc = 1) {
  cout << x;
  if (suc == 1) cout << "\n";
  if (suc == 2) cout << " ";
}
ll read() {
  ll i;
  cin >> i;
  return i;
}
vi readvi(int n, int off = 0) {
  vi v(n);
  for (int i = int(0); i < int(n); i++) v[i] = read() + off;
  return v;
}
template <class T>
void print(const vector<T>& v, int suc = 1) {
  for (int i = int(0); i < int(v.size()); i++)
    print(v[i], i == int(v.size()) - 1 ? suc : 2);
}
string readString() {
  string s;
  cin >> s;
  return s;
}
template <class T>
T sq(const T& t) {
  return t * t;
}
void yes(bool ex = true) {
  cout << "Yes"
       << "\n";
  if (ex) exit(0);
}
void no(bool ex = true) {
  cout << "No"
       << "\n";
  if (ex) exit(0);
}
void possible(bool ex = true) {
  cout << "Possible"
       << "\n";
  if (ex) exit(0);
}
void impossible(bool ex = true) {
  cout << "Impossible"
       << "\n";
  if (ex) exit(0);
}
constexpr ll ten(int n) { return n == 0 ? 1 : ten(n - 1) * 10; }
const ll infLL = LLONG_MAX / 3;
const int inf = INT_MAX / 2 - 100;
int topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
int topbit(ll t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
int botbit(signed first) { return first == 0 ? 32 : __builtin_ctz(first); }
int botbit(ll first) { return first == 0 ? 64 : __builtin_ctzll(first); }
int popcount(signed t) { return __builtin_popcount(t); }
int popcount(ll t) { return __builtin_popcountll(t); }
bool ispow2(int i) { return i && (i & -i) == i; }
ll mask(int i) { return (ll(1) << i) - 1; }
bool inc(int first, int second, int c) {
  return first <= second && second <= c;
}
template <class t>
void mkuni(vc<t>& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
ll rand_int(ll l, ll r) {
  static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
  return uniform_int_distribution<ll>(l, r)(gen);
}
template <class t>
void myshuffle(vc<t>& first) {
  for (int i = int(0); i < int(int(first.size())); i++)
    swap(first[i], first[rand_int(0, i)]);
}
template <class t>
int lwb(const vc<t>& v, const t& first) {
  return lower_bound(v.begin(), v.end(), first) - v.begin();
}
struct unionfind {
  vi p, s;
  int c;
  unionfind(int n = 0) : p(n, -1), s(n, 1), c(n) {}
  int find(int first) {
    return p[first] == -1 ? first : (p[first] = find(p[first]));
  }
  bool unite(int first, int second) {
    first = find(first);
    second = find(second);
    if (first == second) return false;
    p[second] = first;
    s[first] += s[second];
    c--;
    return true;
  }
  bool same(int first, int second) { return find(first) == find(second); }
  int sz(int first) { return s[find(first)]; }
};
template <class t>
vi toposort(vvc<t> g) {
  int n = g.size();
  vi first(n);
  for (int i = int(0); i < int(n); i++)
    for (auto e : g[i]) first[e]++;
  queue<int> q;
  for (int i = int(0); i < int(n); i++)
    if (first[i] == 0) q.push(i);
  vi res;
  for (int i = int(0); i < int(n); i++) {
    if (q.empty()) return {};
    int v = q.front();
    q.pop();
    res.push_back(v);
    for (auto e : g[v])
      if (--first[e] == 0) q.push(e);
  }
  return res;
}
template <class E>
struct HLD {
  vvc<E> g;
  int n, rt, cnt;
  vi sub, in, out, par, head, dep;
  int dfs1(int v, int p, int d) {
    par[v] = p;
    dep[v] = d;
    g[v].erase(remove(g[v].begin(), g[v].end(), p), g[v].end());
    for (auto& e : g[v]) {
      sub[v] += dfs1(e, v, d + 1);
      if (sub[g[v][0]] < sub[e]) swap(g[v][0], e);
    }
    return sub[v];
  }
  void dfs2(int v, int h) {
    in[v] = cnt++;
    head[v] = h;
    for (int to : g[v]) dfs2(to, to == g[v][0] ? h : to);
    out[v] = cnt;
  }
  HLD() {}
  HLD(const vvc<E>& gg, int rr)
      : g(gg),
        n(g.size()),
        rt(rr),
        cnt(0),
        sub(n, 1),
        in(n),
        out(n),
        par(n, -1),
        head(n),
        dep(n) {
    dfs1(rt, -1, 0);
    dfs2(rt, rt);
  }
  int lca(int first, int second) {
    while (head[first] != head[second]) {
      if (dep[head[first]] > dep[head[second]]) swap(first, second);
      second = par[head[second]];
    }
    if (dep[first] > dep[second]) swap(first, second);
    return first;
  }
  int len(int first, int second) {
    return dep[first] + dep[second] - dep[lca(first, second)] * 2;
  }
  bool asde(int first, int second) {
    return in[first] <= in[second] && out[second] <= out[first];
  }
  unionfind uf;
  vi has, dif;
  int k;
  vc<pi> buf;
  int ac(int v) { return uf.find(v * 2) / 2; }
  vi memo;
  int dfs(int v) {
    for (auto to : g[v]) {
      memo[to] = dfs(to);
    }
    buf[ac(v)] = pi(0, k);
    for (auto to : g[v]) {
      buf[ac(to)] = pi(0, k);
    }
    for (auto to : g[v]) {
      int w = memo[to];
      if (w == inf) return inf;
      int i = uf.find(to * 2);
      int t = i % 2;
      i /= 2;
      if (!has[i]) continue;
      if (t == 0) {
        chmax(buf[i].first, w + 1);
      } else {
        chmin(buf[i].second, k - w - 1);
      }
      if (buf[i].second < buf[i].first) return inf;
    }
    for (int waf = int(0); waf < int(2); waf++) {
      int vac = uf.find(v * 2);
      int vt = vac % 2;
      vac /= 2;
      int lw, up;
      tie(lw, up) = buf[vac];
      if (vt) {
        tie(lw, up) = pi(k - up, k - lw);
      }
      for (auto to : g[v]) {
        int i = uf.find(to * 2);
        int t = i % 2;
        i /= 2;
        if (!has[i]) continue;
        dif[to] = t;
        if (i == vac) {
          dif[to] ^= vt;
          continue;
        }
        int l, r;
        tie(l, r) = buf[i];
        if ((k - r < l) ^ waf) {
          tie(l, r) = pi(k - r, k - l);
          dif[to] ^= 1;
        }
        chmax(lw, l);
        chmin(up, r);
      }
      if (lw <= up) {
        void(0);
        return lw;
      }
    }
    return inf;
  }
  void geth(int v, int p, int t, vvc<int>& h) {
    if (has[ac(v)]) {
      if (t == 0) {
        h[v].push_back(p);
      } else {
        h[p].push_back(v);
      }
    }
    for (auto to : g[v]) {
      geth(to, v, t ^ dif[to], h);
    }
  }
  void slv(int m) {
    uf = unionfind(n * 2);
    auto unitesub = [&](int v, int p) {
      while (1) {
        v = ac(v);
        void(0);
        if (dep[v] - dep[p] >= 2) {
          void(0);
          for (int t = int(0); t < int(2); t++) {
            uf.unite(par[v] * 2 + t, v * 2 + t);
          }
          v = par[v];
        } else
          break;
      }
    };
    vi ls;
    vc<pi> es;
    for (int _ = int(0); _ < int(m); _++) {
      int first, second;
      cin >> first >> second;
      first--;
      second--;
      int c = lca(first, second);
      unitesub(first, c);
      unitesub(second, c);
      if (first != c && second != c) {
        es.emplace_back(first, second);
      }
      if (first != c)
        ls.push_back(first);
      else
        ls.push_back(second);
    }
    for (auto e : es) {
      for (int t = int(0); t < int(2); t++) {
        uf.unite(e.first * 2 + t, e.second * 2 + 1 - t);
      }
    }
    has.resize(n);
    for (auto i : ls) has[ac(i)] = 1;
    for (int i = int(0); i < int(n); i++)
      if (uf.same(i * 2, i * 2 + 1)) {
        print(-1);
        return;
      }
    dif.resize(n);
    buf.resize(n);
    memo.resize(n);
    int lw = -1, up = n - 1;
    while (up - lw > 1) {
      const int mid = (lw + up) / 2;
      k = mid;
      if (dfs(0) < inf)
        up = mid;
      else
        lw = mid;
    }
    k = up;
    void(0);
    int tmp = dfs(0);
    void(0);
    assert(tmp < inf);
    void(0);
    vvc<int> h(n);
    geth(0, -1, 0, h);
    void(0);
    void(0);
    void(0);
    vi ans(n);
    vi ord = toposort(h);
    for (auto i : ord) {
      for (auto j : h[i]) chmax(ans[j], ans[i] + 1);
    }
    for (auto& v : ans) v++;
    print(k + 1);
    print(ans);
  }
};
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  int n, m;
  cin >> n >> m;
  vvc<int> t(n);
  for (int _ = int(0); _ < int(n - 1); _++) {
    int first, second;
    cin >> first >> second;
    first--;
    second--;
    t[first].push_back(second);
    t[second].push_back(first);
  }
  HLD<int> hld(t, 0);
  hld.slv(m);
}