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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long rand(long long x, long long y) {
  return rng() % (y + 1 - x) + x;
}
string inline to_string(char c) {
  string second(1, c);
  return second;
}
template <typename T>
inline T gcd(T a, T b) {
  return a == 0 ? llabs(b) : gcd(b % a, a);
}
using ll = int;
using ld = long double;
using pi = pair<ll, ll>;
using spi = pair<ll, pi>;
using dpi = pair<pi, pi>;
ll n, m, mi[(500006)], st[(500006)], en[(500006)], co, p[(500006)][19],
    stuff[(500006)], depth[(500006)], done, ans[(500006)], tmp[(500006)];
pi store[(500006)];
vector<int> v[(500006)];
struct ufds_ {
  pi p[(500006)];
  ufds_() {
    for (ll i = 0; i <= ll((500006) - 1); ++i) p[i] = pi(i, 0);
  }
  pi find(int x) {
    if (p[x].first == x) return p[x];
    pi res = find(p[x].first);
    p[x].second ^= res.second;
    return pi(p[x].first = res.first, p[x].second);
  }
  void merge(int x, int y, int c) {
    pi one = find(x), two = find(y);
    if (one.first == two.first) {
      if ((one.second ^ two.second) != c) {
        cout << "-1\n";
        exit(0);
      }
    } else {
      p[two.first] = pi(one.first, two.second ^ one.second ^ c);
    }
  }
} u;
void dfs(int x, int par) {
  p[x][0] = par;
  st[x] = co++;
  for (auto i : v[x])
    if (i ^ par) depth[i] = depth[x] + 1, dfs(i, x);
  en[x] = co - 1;
}
bool isp(int a, int b) { return st[a] <= st[b] && en[a] >= en[b]; }
int lca(int x, int y) {
  if (isp(x, y)) return x;
  if (isp(y, x)) return y;
  for (ll i = 18; i >= ll(0); --i)
    if (!isp(p[x][i], y)) x = p[x][i];
  return p[x][0];
}
int fpar(int x, int k) {
  for (ll i = 0; i <= ll(18); ++i)
    if (1 << i & k) x = p[x][i];
  return x;
}
bool yes;
void dp(int x, int mid) {
  if (!yes) return;
  for (auto i : v[x])
    if (i ^ p[x][0]) {
      dp(i, mid);
      if (!yes) return;
    }
  for (auto i : v[x])
    if (i ^ p[x][0]) {
      store[u.find(i).first].first = -1;
    }
  vector<int> ppl = {x};
  store[u.find(x).first] = pi(1, mid);
  for (auto i : v[x])
    if (i ^ p[x][0]) {
      ll guy = u.find(i).first;
      if (store[guy].first == -1) {
        store[guy] = pi(1, mid);
        ppl.emplace_back(i);
      }
      if (u.find(i).second)
        store[guy].second = min(store[guy].second, mid - mi[i]);
      else
        store[guy].first = max(store[guy].first, mi[i] + 1);
    }
  pi me = store[u.find(x).first];
  if (u.find(x).second) me = pi(mid - me.second + 1, mid - me.first + 1);
  ll L = me.first, R = me.second;
  pi ban = pi(n + 1, 0);
  for (auto i : ppl) {
    pi me = store[u.find(i).first];
    if (me.first > me.second) {
      yes = 0;
      return;
    }
    pi rev = pi(mid - me.second + 1, mid - me.first + 1);
    if (me > rev) swap(me, rev);
    L = max(L, me.first);
    R = min(R, rev.second);
    if (me.second + 1 < rev.first)
      ban.first = min(ban.first, me.second + 1),
      ban.second = max(ban.second, rev.first - 1);
  }
  if (L > R) {
    yes = 0;
    return;
  }
  if (L < ban.first)
    mi[x] = L;
  else if (L > ban.second)
    mi[x] = L;
  else if (R > ban.second)
    mi[x] = ban.second + 1;
  else {
    yes = 0;
    return;
  }
  if (done) {
    tmp[u.find(x).first] = u.find(x).second;
    for (auto i : ppl) {
      if (i == x) continue;
      pi guy = u.find(i);
      if (store[guy.first].first <= mi[x] && mi[x] <= store[guy.first].second) {
        tmp[guy.first] = 0;
      } else {
        tmp[guy.first] = 1;
      }
    }
    for (auto i : v[x])
      if (i ^ p[x][0]) {
        ans[i] = tmp[u.find(i).first] ^ u.find(i).second;
      }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (ll i = 0; i <= ll(n - 2); ++i) {
    int a, b;
    cin >> a >> b;
    v[a].emplace_back(b), v[b].emplace_back(a);
  }
  dfs(1, 1);
  for (ll j = 1; j <= ll(18); ++j)
    for (ll i = 1; i <= ll(n); ++i) p[i][j] = p[p[i][j - 1]][j - 1];
  for (ll i = 0; i <= ll(m - 1); ++i) {
    int a, b;
    cin >> a >> b;
    int la = lca(a, b);
    if (a ^ la) {
      int A = fpar(a, depth[a] - depth[la] - 1);
      ++stuff[a], --stuff[A];
    }
    if (b ^ la) {
      int B = fpar(b, depth[b] - depth[la] - 1);
      ++stuff[b], --stuff[B];
    }
    if (a != la && b != la) {
      u.merge(a, b, 1);
    }
  }
  function<void(ll)> go = [&](ll x) {
    for (auto i : v[x])
      if (i ^ p[x][0]) {
        go(i);
        stuff[x] += stuff[i];
      }
    if (stuff[x]) {
      u.merge(x, p[x][0], 0);
    }
  };
  go(1);
  auto bstar = [&](int mid) {
    yes = 1, dp(1, mid);
    return yes;
  };
  ll st = 0, en = n;
  while (en - st > 1) {
    ll mid = (st + en) >> 1;
    if (bstar(mid))
      en = mid;
    else
      st = mid;
  }
  cout << en << '\n';
  done = 1;
  assert(bstar(en));
  function<void(ll)> get_ans = [&](ll x) {
    if (ans[x]) mi[x] = en + 1 - mi[x];
    for (auto i : v[x])
      if (i ^ p[x][0]) {
        ans[i] ^= ans[x];
        get_ans(i);
      }
  };
  get_ans(1);
  for (ll i = 1; i <= ll(n); ++i) cout << mi[i] << ' ';
  cout << '\n';
}