Problem: 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

Solution (in CPP):

Solution:
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <vector>

typedef long long LL;

int read() {
  int ans = 0, c, f = 1;
  while (!isdigit(c = getchar()))
    if (c == '-') f *= -1;
  do ans = ans * 10 + c - '0';
  while (isdigit(c = getchar()));
  return ans * f;
}

const int N = 2050;

int n, pre[N], nxt[N * 2], to[N * 2], cnt;

void addEdge(int x, int y) {
  nxt[cnt] = pre[x];
  to[pre[x] = cnt++] = y;
  nxt[cnt] = pre[y];
  to[pre[y] = cnt++] = x;
}

int A[N * 2];
int m, p2[N], n2[N * 2], t2[N * 2], inv[N * 2], c2;
int dir[N * 2], S[N];
bool vis[N];

void addE2(int x, int y) {
  n2[c2] = p2[x];
  t2[p2[x] = c2++] = y;
  n2[c2] = p2[y];
  t2[p2[y] = c2++] = x;
}

int fa[N];
int Find(int x) { return ~fa[x] ? fa[x] = Find(fa[x]) : x; }

int dfs0(int x, int f) {
  for (int i = pre[x]; ~i; i = nxt[i])
    if (to[i] != f)
      S[x] += dfs0(to[i], x);
  for (int i = p2[x]; ~i; i = n2[i]) {
    ++S[x];
    if (vis[t2[i]]) S[Find(t2[i])] -= 2;
  }
  fa[x] = f;
  vis[x] = true;
  return S[x];
}

void dfs(int x, int f) {
  for (int i = pre[x]; ~i; i = nxt[i])
    if (to[i] != f) dfs(to[i], x);
  int t = -1;
  for (int i = p2[x]; ~i; i = n2[i])
    if (dir[i] == -1) {
      if (t2[i] == x) {
        dir[i] = 0;
        dir[inv[i]] = 1;
      } else if (~t) {
        t2[inv[i]] = t2[t];
        t2[inv[t]] = t2[i];
        inv[inv[i]] = inv[t];
        inv[inv[t]] = inv[i];
        t = -1;
      } else {
        t = i;
      }
    }
  if (~t) {
    t2[inv[t]] = f;
    n2[t] = p2[f];
    p2[f] = t;
  }
}

int getd(int x) {
  if (~dir[x]) return dir[x];
  else return dir[x] = getd(inv[x]) ^ 1;
}

int main() {
  n = read(); m = read();
  memset(pre, -1, sizeof pre);
  memset(p2, -1, sizeof p2);
  memset(dir, -1, sizeof dir);
  memset(fa, -1, sizeof fa);
  for (int i = 1; i < n; ++i) addEdge(read(), read());
  for (int i = 0; i < m; ++i) addE2(read(), read());
  for (int i = 0; i < c2; ++i) A[i] = t2[i], inv[i] = i ^ 1;
  dfs0(1, 0);
  int ans = 0;
  for (int i = 1; i <= n; ++i) ans += std::min(S[i], 2);
  dfs(1, 0);
  printf("%d\n", ans);
  for (int i = 0; i < c2; i += 2)
    if (getd(i)) printf("%d %d\n", A[i], A[i + 1]);
    else printf("%d %d\n", A[i + 1], A[i]);
  return 0;
}