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<cassert>
#include<deque>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, M;

VI G[2011];
int par[2011];
VI ord;
VI path(int s, int t) {
    par[t] = t;
    ord.clear();
    ord.push_back(t);
    REP (i_, N) {
	int v = ord[i_];
	EACH (e, G[v]) if (*e != par[v]) {
	    par[*e] = v;
	    if (*e == s) goto BREAK;
	    ord.push_back(*e);
	}
    }
BREAK:


    VI ret;
    while (1) {
	ret.push_back(s);
	if (s == t) break;
	s = par[s];
    }

    return ret;
}

struct Edge {
    deque<int> dq;
    int parent;
    bool flip;
    bool order;
    bool fix;

    Edge(int u_, int v_) {
	VI p = path(u_, v_);
	dq = deque<int>(p.begin(), p.end());
	parent = -1;
	flip = order = fix = false;
    }

    int u() const { return dq.front(); }
    int v() const { return dq.back(); }

    bool one_end(int x) const {
	return x == u() || x == v();
    }
};
vector<Edge> edges;

bool ban[2011];
int Eu[2011], Ev[2011];

void MAIN() {
    scanf("%d%d", &N, &M);
    REP (i, N-1) {
	int x, y;
	scanf("%d%d", &x, &y);
	x--; y--;
	G[x].push_back(y);
	G[y].push_back(x);
    }
    REP (i, M) {
	int u, v;
	scanf("%d%d", &u, &v);
	u--; v--;
	Eu[i] = u; Ev[i] = v;
	edges.emplace_back(u, v);
    }

    int ans = 0;
    {
	vector<pair<int, int> > g;
	REP (i, M) {
	    REP (j, edges[i].dq.size()-1u) {
		int x = edges[i].dq[j];
		int y = edges[i].dq[j+1];
		g.emplace_back(min(x, y), max(x, y));
	    }
	}
	sort(g.begin(), g.end());
	for (int i=0, j=0; i<(int)g.size(); i=j) {
	    while (j < (int)g.size() && g[i] == g[j]) {
		j++;
	    }
	    if (j-i >= 2) ans += 2;
	    else ans++;
	}
    }

    int rest = N;
    while (rest > 1) {
	int leaf = -1;
	REP (v, N) if (!ban[v]) {
	    int cnt = 0;
	    EACH (e, G[v]) if (!ban[*e]) {
		cnt++;
	    }
	    if (cnt == 1) {
		leaf = v;
		break;
	    }
	}

	VI Es;
	REP (i, edges.size()) if (!edges[i].fix && edges[i].one_end(leaf)) {
	    Es.push_back(i);
	    if (Es.size() == 2u) break;
	}

	if (Es.empty()) {
	} else if (Es.size() == 1u) {
	    int id = Es[0];
	    if (edges[id].u() == leaf) edges[id].dq.pop_front();
	    else edges[id].dq.pop_back();
	    if (edges[id].dq.size() == 1u) edges[id].fix = true;
	} else {
	    int a = Es[0], b = Es[1];
	    int ax = (edges[a].u() == leaf? edges[a].v(): edges[a].u());
	    int bx = (edges[b].u() == leaf? edges[b].v(): edges[b].u());

	    if (ax == bx) {
		if (edges[a].u() == leaf) edges[a].order = true;
		if (edges[b].v() == leaf) edges[b].order = true;
	    } else {
		edges[a].parent = edges.size();
		edges[b].parent = edges.size();
		if (edges[a].u() != ax) edges[a].flip = true;
		if (edges[b].v() != bx) edges[b].flip = true;
		edges.emplace_back(ax, bx);
	    }
	    edges[a].fix = true;
	    edges[b].fix = true;

	    REP (j, edges.size()) if (!edges[j].fix && edges[j].one_end(leaf)) {
		if (edges[j].v() == leaf) edges[j].dq.pop_back();
		else edges[j].dq.pop_front();

		if (edges[j].dq.size() == 1u) edges[j].fix = true;
	    }
	}
	rest--;
	ban[leaf] = true;
    }
    for (int i=edges.size(); i--;) {
//	if (!edges[i].fix) {
//	    printf("%d\n", i);
//	    rprintf("%d", edges[i].dq.begin(), edges[i].dq.end());
//	}
	assert(edges[i].fix);
	if (edges[i].parent != -1) {
	    edges[i].order = edges[edges[i].parent].order ^ edges[i].flip;
	}
    }

    printf("%d\n", ans);
    REP (i, M) {
	int u = Eu[i], v = Ev[i];
	if (edges[i].order) swap(u, v);
	printf("%d %d\n", u+1, v+1);
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}

