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 N, M, mars[2019], lca[2009][2009], sol[200009], leftEnd[2009], rightEnd[2009], lev[2009], t[2009];
vector < int > v[2009];

void dfs0 (int nod, int tata)
{
    for (auto it : v[nod])
        if (it != tata)
            lev[it] = lev[nod] + 1, t[it] = nod, dfs0 (it, nod);
}

int getLca (int i, int j)
{
    if (i > j) swap (i, j);
    if (lca[i][j] != 0) return lca[i][j];
    int ans;
    if (lev[i] > lev[j]) ans = getLca (t[i], j);
    else ans = getLca (i, t[j]);
    lca[i][j] = ans;
    return ans;
}

int lower (int x, int y)
{
    if (lev[x] < lev[y]) return y;
    return x;
}

void dfs (int nod)
{
    for (auto it : v[nod])
        if (it != t[nod])
            dfs (it), mars[nod] += mars[it];
}

void init ()
{
    dfs0 (1, -1);
    for (int i=1; i<=N; i++)
        lca[i][i] = i;
    for (int i=1; i<=N; i++)
        for (int j=i + 1; j<=N; j++)
            lca[i][j] = getLca (i, j);
    for (int i=1; i<=N; i++)
        for (int j=1; j<i; j++)
            lca[i][j] = lca[j][i];
    for (int i=1; i<=M; i++)
    {
        int x = leftEnd[i], y = rightEnd[i];
        mars[x] ++, mars[y] ++, mars[lca[x][y]] -= 2;
    }
    dfs (1);
    int ans = 0;
    for (int i=2; i<=N; i++)
        ans += min (mars[i], 2);
    printf ("%d\n", ans);
}

int cntQ, done[2018];
bool ap[2018];

void markSolvedPath (int x, int y)
{
    while (x != y)
    {
        if (lev[x] > lev[y]) done[x] = 1, x = t[x];
        else done[y] = 1, y = t[y];
    }
}

void solve (vector < pair < int, pair < int, int > > > &paths)
{
    int edge = -1;
    for (int i=1; i<=N; i++)
        if (ap[i] == 0)
        {
            int sz = 0;
            for (auto it : v[i])
                sz += (ap[it] == 0);
            if (sz == 1)
                edge = i;
        }
    if (edge == -1) return ;
    ap[edge] = 1;
    if (mars[edge] <= 1 || done[edge])
    {
        vector < pair < int, pair < int, int > > > p;
        for (auto it : paths)
        {
            int pos = it.first, x = it.second.first, y = it.second.second;
            if (x == edge) x = t[edge];
            if (y == edge) y = t[edge];
            if (x != y) p.push_back ({pos, {x, y}});
        }
        solve (p);
        return ;
    }
    vector < pair < int, pair < int, int > > > p;
    int pos = ++cntQ, x = -1, y = -1, px, py;
    for (auto it : paths)
        if (it.second.second != it.second.first)
        {
            if (it.second.first != edge && it.second.second != edge) p.push_back (it);
            else
            {
                int z, pz;
                if (it.second.first == edge) z = it.second.second, pz = it.first;
                else z = it.second.first, pz = -it.first;
                if (x == -1) x = z, px = pz;
                else
                if (y == -1) y = z, py = pz;
                else
                if (pz > 0) p.push_back ({it.first, {t[edge], z}});
                else p.push_back ({it.first, {z, t[edge]}});
            }
        }
    int z = lower (lca[x][y], lower (lca[x][t[edge]], lca[y][t[edge]]));
    if (t[edge] != z)
        markSolvedPath (t[edge], z);
    p.push_back ({pos, {x, y}});
    solve (p);
    if (py > 0) sol[py] = sol[pos];
    else sol[-py] = sol[pos] ^ 1;
    if (px < 0) sol[-px] = sol[pos];
    else sol[px] = sol[pos] ^ 1;
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &M), cntQ = M;
for (int i=1; i<N; i++)
{
    int x, y;
    scanf ("%d %d", &x, &y);
    v[x].push_back (y);
    v[y].push_back (x);
}
vector < pair < int, pair < int, int > > > curr;
for (int i=1; i<=M; i++)
{
    scanf ("%d %d", &leftEnd[i], &rightEnd[i]);
    curr.push_back ({i, {leftEnd[i], rightEnd[i]}});
}
init ();
solve (curr);
for (int i=1; i<=M; i++)
    if (sol[i]) printf ("%d %d\n", leftEnd[i], rightEnd[i]);
    else printf ("%d %d\n", rightEnd[i], leftEnd[i]);
return 0;
}
