Takahashi loves walking on a tree. The tree where Takahashi walks has N vertices numbered 1 through N. The i-th of the N-1 edges connects Vertex a_i and Vertex b_i.

Takahashi has scheduled M walks. The i-th walk is done as follows:

* The walk involves two vertices u_i and v_i that are fixed beforehand.
* Takahashi will walk from u_i to v_i or from v_i to u_i along the shortest path.



The happiness gained from the i-th walk is defined as follows:

* The happiness gained is the number of the edges traversed during the i-th walk that satisfies one of the following conditions:
* In the previous walks, the edge has never been traversed.
* In the previous walks, the edge has only been traversed in the direction opposite to the direction taken in the i-th walk.



Takahashi would like to decide the direction of each walk so that the total happiness gained from the M walks is maximized. Find the maximum total happiness that can be gained, and one specific way to choose the directions of the walks that maximizes the total happiness.

Constraints

* 1 ≤ N,M ≤ 2000
* 1 ≤ a_i , b_i ≤ N
* 1 ≤ u_i , v_i ≤ N
* a_i \neq b_i
* u_i \neq v_i
* The graph given as input is a tree.

Input

Input is given from Standard Input in the following format:


N M
a_1 b_1
:
a_{N-1} b_{N-1}
u_1 v_1
:
u_M v_M


Output

Print the maximum total happiness T that can be gained, and one specific way to choose the directions of the walks that maximizes the total happiness, in the following format:


T
u^'_1 v^'_1
:
u^'_M v^'_M


where (u^'_i,v^'_i) is either (u_i,v_i) or (v_i,u_i), which means that the i-th walk is from vertex u^'_i to v^'_i.

Examples

Input

4 3
2 1
3 1
4 1
2 3
3 4
4 2


Output

6
2 3
3 4
4 2


Input

5 3
1 2
1 3
3 4
3 5
2 4
3 5
1 5


Output

6
2 4
3 5
5 1


Input

6 4
1 2
2 3
1 4
4 5
4 6
2 4
3 6
5 6
4 5


Output

9
2 4
6 3
5 6
4 5
#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 4005;

int n, m, p, ans, s[N], t[N], deg[N], dep[N], par[N], dis[N][N], vis[N][N];
vector <int> adj[N], pth[N];
bool del[N], ers[N], rev[N];
vector <pii> bel[N];

inline void DFS(int x) {
  for (auto y : adj[x]) {
    if (y != par[x]) {
      par[y] = x, dep[y] = dep[x] + 1, DFS(y);
    }
  }
}

inline int Dis(int x, int y) {
  if (x == y) {
    return 0;
  }
  if (dis[x][y]) {
    return dis[x][y];
  }
  if (dep[x] >= dep[y]) {
    return dis[x][y] = Dis(par[x], y) + 1;
  } else {
    return dis[x][y] = Dis(x, par[y]) + 1;
  }
}

inline void Add(int i, int x, int y) {
  if (x == y) {
    return ;
  }
  s[i] = x, t[i] = y;
  vector <int> l, r;
  int u = x, v = y;
  while (u != v) {
    if (dep[u] >= dep[v]) {
      l.pb(u), u = par[u];
    } else {
      r.pb(v), v = par[v];
    }
  }
  reverse(r.begin(), r.end());
  for (auto p : l) {
    pth[i].pb(p);
  }
  pth[i].pb(u);
  for (auto p : r) {
    pth[i].pb(p);
  }
  for (int j = 0; j < pth[i].size(); ++j) {
    bel[pth[i][j]].pb(mp(i, j));
    if (j < pth[i].size() - 1) {
      u = pth[i][j], v = pth[i][j + 1];
      if (u > v) {
        swap(u, v);
      }
      if (vis[u][v] < 2) {
        ++vis[u][v], ++ans;
      }
    }
  }
}

inline bool Go(int i, int j, int x) {
  return (j < pth[i].size() - 1 && pth[i][j + 1] == x) || (j && pth[i][j - 1] == x);
}

inline int Get(int i, int j, int x) {
  return j < pth[i].size() - 1 && pth[i][j + 1] == x ? pth[i].back() : pth[i][0];
}

inline void Make(int i, int x, int y) {
  if (rev[i]) {
    swap(x, y);
  }
  if (Dis(s[i], x) + Dis(y, t[i]) + 1 != Dis(s[i], t[i])) {
    rev[i] = !rev[i];
  }
}

inline void Solve() {
  int x = 0;
  for (int i = 1; i <= n; ++i) {
    if (!ers[i] && deg[i] == 1) {
      x = i;
    }
  }
  if (!x) {
    return ;
  }
  int y = 0;
  for (auto p : adj[x]) {
    if (!ers[p]) {
      y = p;
    }
  }
  ers[x] = true, --deg[y];
  pii a = mp(0, 0), b = mp(0, 0);
  for (auto p : bel[x]) {
    if (!del[p.X] && Go(p.X, p.Y, y)) {
      if (a.X) {
        b = p;
      } else {
        a = p;
      }
    }
  }
  if (!b.X) {
    Solve();
  } else {
    Make(a.X, y, x), Make(b.X, x, y);
    Add(++p, Get(a.X, a.Y, y), Get(b.X, b.Y, y));
    del[a.X] = del[b.X] = true;
    int q = p;
    Solve();
    rev[a.X] ^= rev[q], rev[b.X] ^= rev[q];
  }
}

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n), Read(m);
  for (int i = 1, x, y; i < n; ++i) {
    Read(x), Read(y);
    adj[x].pb(y), adj[y].pb(x);
    ++deg[x], ++deg[y];
  }
  DFS(1);
  for (int i = 1, x, y; i <= m; ++i) {
    Read(x), Read(y);
    Add(++p, x, y);
  }
  printf("%d\n", ans);
  Solve();
  for (int i = 1; i <= m; ++i) {
    if (rev[i]) {
      printf("%d %d\n", t[i], s[i]);
    } else {
      printf("%d %d\n", s[i], t[i]);
    }
  }
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}
