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>
#define N 2005
using namespace std;
int n,m,sum,rd[N];
int dep[N],f[N],ans[N];
struct E 
{
	int u,v; 
	E(int u=0,int v=0) : u(u),v(v) {} 
};
vector<E> now;
struct Edge
{
	int next,to;
}edge[N<<1];int head[N],cnt;
void add_edge(int from,int to)
{
	edge[++cnt].next=head[from];
	edge[cnt].to=to;
	head[from]=cnt;
}

template <class T> inline void read(T &x)
{
	char c;int sign=1;
	while((c=getchar())>'9'||c<'0') if(c=='-') sign=-1; x=c-48;
	while((c=getchar())>='0'&&c<='9') x=(x<<1)+(x<<3)+c-48; x*=sign;
}

void dfs(int rt,int fa)
{
	f[rt] = fa;
	dep[rt] = dep[fa] + 1;
	for(int i=head[rt];i;i=edge[i].next)
	{
		int v=edge[i].to;
		if(v == fa) continue;
		dfs(v,rt);
	}
}
void sig(int u,int v)
{
	if(dep[u] < dep[v]) swap(u,v);
	while(dep[u] > dep[v]) { ++ans[u]; u = f[u]; }
	while(u != v) { ++ans[u]; ++ans[v]; u = f[u]; v = f[v]; }
}
bool operator == (E a,E b) { return (a.u == b.u) && (a.v == b.v); }
vector<E> solve(vector<E> rt)
{
	if(!rt.size()) return rt;
	int u,v;//v is leaf
	for(v=1;v<=n;++v) if(rd[v] == 1) break;
	if(v > n) return rt;
	for(int i=head[v];i;i=edge[i].next)
	{
		u = edge[i].to;
		if(rd[u]) break;
	}
	--rd[u]; --rd[v];
	vector<E> nxt,l;//有v点的边加入l集合 
	int pos[N],id[N];
	//id表示l中的元素在rt中的位置 
	//pos表示rt中的元素在nxt中的位置 
	memset(pos,-1,sizeof(pos));
	for(int i=0;i<(int)rt.size();++i)
	{
		if(rt[i].u == v || rt[i].v == v)
		{
			l.push_back(rt[i]);
			id[l.size() - 1] = i;
		}
		else
		{
			nxt.push_back(rt[i]);
			pos[i] = nxt.size() - 1;
		}
	}
	if(!l.size()) return solve(rt);
	for(int i=0;i + 1<(int)l.size();i += 2)//配对 
	{
		if(l[i].v == v) swap(l[i].u,l[i].v);
		if(l[i + 1].v == v) swap(l[i + 1].u,l[i + 1].v);
		if(l[i] == l[i + 1])
		{
			if(rt[id[i]] == rt[id[i + 1]]) swap(rt[id[i]].u,rt[id[i]].v);
			continue;
		}
		nxt.push_back(E(l[i].v,l[i + 1].v));
		pos[id[i]] = pos[id[i + 1]] = nxt.size() - 1;
	}
	if(l.size() & 1)//落单 
	{
		int p = l.size() - 1;
		if(l[p].v == v) swap(l[p].u,l[p].v);
		if(l[p].v != u)
		{
			nxt.push_back(E(u,l[p].v));
			pos[id[p]] = nxt.size() - 1;
		}
	}
	nxt = solve(nxt);
	for(int i=0;i<(int)rt.size();++i)
	  if(pos[i] != -1 && !(rt[i].u == nxt[pos[i]].u || rt[i].v == nxt[pos[i]].v))
		swap(rt[i].u,rt[i].v);
	return rt;
}

int main()
{
	read(n);read(m);
	for(int i=1;i<n;++i)
	{
		int x,y;
		read(x);read(y);
		add_edge(x,y);
		add_edge(y,x);
		++rd[x];++rd[y];
	}
	dfs(1,0);
	for(int i=1;i<=m;++i)
	{
		int u,v; read(u);read(v);
		sig(u,v); now.push_back(E(u,v));
	}
	for(int i=2;i<=n;++i) sum += min(2,ans[i]);
	printf("%d\n",sum);

	now = solve(now);
	for(int i=0;i<(int)now.size();++i) printf("%d %d\n",now[i].u,now[i].v);
	return 0;
}