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;
int read();
int n, m;
int deg[2003], hd[2003], nx[4003], to[4003], cnt;
void add(int u, int v) {
    nx[++cnt] = hd[u], hd[u] = cnt, to[cnt] = v, ++deg[u];
    nx[++cnt] = hd[v], hd[v] = cnt, to[cnt] = u, ++deg[v];
}

set<int> s[2003];
struct E {
    int iu, iv, nu, nv, fa, res;
    void init(int id) {
        iu = nu = read(), iv = nv = read(), s[nu].insert(id), s[nv].insert(id);
    }
    void trans(int u, int v) { (nu == u ? nu : nv) = v; }
} e[2003];

queue<int> q;

int tag[2003];
int Tag(int u, int fa, int t1, int t2) {
    if (u == t1) return 1;
    if (u == t2) return 2;
    int rt = 0;
    for (int i = hd[u], v, t; i; i = nx[i])
        if ((v = to[i]) != fa) {
            if ((t = Tag(v, u, t1, t2)) == 3) return tag[i >> 1] = 1, 3;
            rt |= t;
        }
    return rt;
}
void work() {
    for (int u = 1; u <= n; ++u)
        if (deg[u] == 1) q.push(u);
    for (int u, v, a, b; !q.empty();) {
        u = q.front(), v = a = 0, q.pop();
        for (int i = hd[u]; i; i = nx[i])
            if (deg[v = to[i]] > 1) {
                a = i >> 1;
                break;
            }
        if (!v) continue;
        if ((--deg[v]) == 1) q.push(v);
        if (!s[u].size()) continue;

        if (tag[a] || s[u].size() == 1) {
            for (; s[u].size(); s[u].erase(a)) {
                a = *s[u].begin(), e[a].trans(u, v);
                e[a].nu != e[a].nv ? (s[v].insert(a), void())
                                   : (s[e[a].nu].erase(a), void());
            }
        } else {
            a = *s[u].begin(), s[u].erase(s[u].begin());
            b = *s[u].begin(), s[u].erase(s[u].begin());
            e[a].nv == u ? (e[a].res ^= 1, swap(e[a].nu, e[a].nv)) : void();
            e[b].nv == u ? (e[b].res ^= 1, swap(e[b].nu, e[b].nv)) : void();
            s[e[a].nv].erase(a), s[e[b].nv].erase(b), e[a].nu = e[b].nv;
            if (e[a].nu != e[a].nv) s[e[a].nu].insert(a), s[e[a].nv].insert(a);
            e[b].fa = a, e[b].res ^= 1 ^ e[a].res;
            Tag(u, 0, e[a].nu, e[a].nv);
            for (; s[u].size(); s[u].erase(a)) {
                a = *s[u].begin(), e[a].trans(u, v);
                e[a].nu != e[a].nv ? (s[v].insert(a), void())
                                   : (s[e[a].nu].erase(a), void());
            }
        }
    }
}

int vis[2003];
int get(int i) {
    if (!i) return 0;
    if (vis[i]) return e[i].res;
    vis[i] = 1;
    return e[i].res ^= get(e[i].fa);
}

int res;
int sum[2003];
bool ins(int u, int fa, int t) {
    if (u == t) return 1;
    for (int i = hd[u], v; i; i = nx[i])
        if ((v = to[i]) != fa)
            if (ins(v, u, t)) return ++sum[i >> 1], 1;
    return 0;
}
void solve() {
    for (int i = 1; i <= m; ++i) ins(e[i].iu, 0, e[i].iv);
    for (int i = 1; i < n; ++i) res += (sum[i] > 0) + (sum[i] > 1);
}

int main() {
    n = read(), m = read(), cnt = 1;
    for (int i = 1; i < n; ++i) add(read(), read());
    for (int i = 1; i <= m; ++i) e[i].init(i);
    work(), solve(), printf("%d\n", res);
    for (int i = 1; i <= m; ++i) {
        get(i) ? swap(e[i].iu, e[i].iv) : void();
        printf("%d %d\n", e[i].iu, e[i].iv);
    }
    return 0;
}
int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = getchar();
    while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
    return x * f;
}