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;

namespace TYC
{
	typedef long long ll;
	typedef pair<int, int> pii;
	const int N = 2005;

	int n, m, tot, fa[N], dep[N], C[N][2];
	vector<int> E[N], Tree[N], Q, T, R;
	struct path 
	{ 
		int a, b, type;
	   	vector<pii> to;
		path() { }
		path(const int _a, const int _b) : a(_a), b(_b), type(-1) { to.clear(); }	
		int ano(const int x) { return a == x ? b : a; }
	} P[N * N];

	inline int read()
	{
		int x = 0, f = 0, ch = getchar();
		while (!isdigit(ch))
			f |= (ch == '-'), ch = getchar();
		while (isdigit(ch))
			x = x * 10 + ch - '0', ch = getchar();
		return f ? -x : x;
	}

	void del(const int u, const int v)
	{
		E[u].erase(find(E[u].begin(), E[u].end(), v));
		E[v].erase(find(E[v].begin(), E[v].end(), u));	
	}

	void dfs(const int u, const int f)
	{
		dep[u] = dep[fa[u] = f] + 1;
		for (int v : E[u])
			if (v != f)
				dfs(v, u);
	}

	inline int LCA(int u, int v)
	{
		while (u != v)
		{
			if (dep[u] < dep[v])
				swap(u, v);
			u = fa[u];
		}
		return u;
	}

	int solve(const int u)
	{
		T = Q;
		Q.clear();
		R.clear();
		for (auto p : T)
			if (P[p].a != u && P[p].b != u)
				Q.push_back(p);
			else if (P[p].a == u && P[p].b == u)
				P[p].type = 0;
			else
				R.push_back(p);

		int ans = min(int(R.size()), 2), f = E[u][0];
		dfs(u, 0);
		while (int(R.size()) >= 2)
		{
			int sz = int(R.size());
			int x = R[sz - 1], y = R[sz - 2];
			R.resize(sz - 2);
			int a = P[x].ano(u), b = P[y].ano(u);
			P[++tot] = path(a, b);
			P[tot].to.push_back({x, P[x].a != a});
			P[tot].to.push_back({y, P[y].b != b});
			Q.push_back(tot);
		}
		for (auto p : R)
		{	
			P[++tot] = P[p].a == u ? path(f, P[p].b) : path(P[p].a, f);
			P[tot].to.push_back({p, 0});
			Q.push_back(tot);
		}
		del(u, f);
		return ans;
	}

	void pushdown(const int i)
	{
		for (auto p : P[i].to)
		{
			P[p.first].type = P[i].type ^ p.second;
			pushdown(p.first);
		}
	}

	int calc()
	{
		for (int i = 1; i <= n; i++)
			E[i] = Tree[i];
		dfs(1, 0);
		for (int i = 1; i <= m; i++)
		{
			int u = P[i].a, v = P[i].b;
			if (P[i].type)
				swap(u, v);
			int lca = LCA(u, v);
			while (u != lca)
				C[u][0] = 1, u = fa[u];
			while (v != lca)
				C[v][1] = 1, v = fa[v];
		}
		int sum = 0;
		for (int i = 1; i <= n; i++)
			sum += C[i][0] + C[i][1];
		return sum;
	}

	void work()
	{
		n = read(), m = read();
		for (int i = 1; i < n; i++)
		{
			int u = read(), v = read();
			E[u].push_back(v);
			E[v].push_back(u);
		}
		for (int i = 1; i <= n; i++)
			Tree[i] = E[i];
		for (int i = 1; i <= m; i++)
		{
			int u = read(), v = read();
			P[++tot] = path(u, v);
			Q.push_back(tot);
		}
		int ans = 0;
		for (int k = 1; k < n; k++)
		{
			int v;
			for (v = 1; v <= n; v++)
				if (int(E[v].size()) == 1)
					break;
			ans += solve(v);
		}
		int d = 0;
		for (auto p : Q)
			P[p].type = d ^= 1;
		R.clear();
		for (int i = 1; i <= tot; i++)
			if (P[i].type != -1)
				R.push_back(i);
		for (auto p : R)
			pushdown(p);
		printf("%d\n", calc());
		for (int i = 1; i <= m; i++)
			if (!P[i].type)
				printf("%d %d\n", P[i].a, P[i].b);
			else
				printf("%d %d\n", P[i].b, P[i].a);
	}
}

int main()
{
	TYC::work();
	return 0;
}