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 pb push_back
using namespace std;
int head[2005],nxt[4005],v[4005],tot=1;
int rs[2005],rt[2005],s[2005],t[2005],n,m;
int deg[2005],c[2005],cnt=0;
bool bl[2005],bv[2005];
bool g[2005][2005];
vector <int> p[2005];
inline void add(int a,int b)
{tot++;nxt[tot]=head[a];head[a]=tot;v[tot]=b;}
bool dfs(int pos,int f,int tar,int u)
{if (pos==tar) return 1;
for (int i=head[pos];i;i=nxt[i])
{if (v[i]==f) continue;
if (dfs(v[i],pos,tar,u))
{g[u][(i>>1)]=1;return 1;}
}
return 0;
}
inline bool rev(int id)
{int sz=p[id].size();swap(s[id],t[id]);
for (int i=0;i<sz;i++) swap(rs[p[id][i]],rt[p[id][i]]);
}
int main (){
	int i,j,a,b,ans=0;
	scanf ("%d%d",&n,&m);
	for (i=1;i<n;i++)
	{scanf ("%d%d",&a,&b);
	deg[a]++;deg[b]++;
	add(a,b);add(b,a);
	}
	for (i=1;i<=m;i++)
	{scanf ("%d%d",&s[i],&t[i]);
	dfs(s[i],0,t[i],i);
	rs[i]=s[i];rt[i]=t[i];
	p[i].pb(i);
	}
	for (i=1;i<n;i++)
	{int o=0;
	for (j=1;j<=m;j++)
	{if (g[j][i]) o++;
	if (o>=2) break;
	}
	ans+=o;
	}
	while (1)
	{int pos=-1,id=-1,nv;cnt=0;
	for (i=1;i<=n;i++)
	{if (bv[i]) continue;
	if (deg[i]==1) {pos=i;break;}
	}
	if (pos==-1) break;
	bv[pos]=1;
	for (i=head[pos];i;i=nxt[i])
	{if (bv[v[i]]) continue;
	id=(i>>1);nv=v[i];
	deg[v[i]]--;
	}
	for (i=1;i<=m;i++)
	{if (bl[i]) continue;
	if (g[i][id]) c[++cnt]=i;
	}
	if (cnt==0) continue;
	if (cnt==1)
	{if (s[c[1]]==pos) {s[c[1]]=nv;}
	else {t[c[1]]=nv;}
	g[c[1]][id]=0;
	if (s[c[1]]==t[c[1]]) bl[c[1]]=0;
	continue;
	}
	for (i=3;i<=cnt;i++)
	{if (s[c[i]]==pos) {s[c[i]]=nv;}
	else {t[c[i]]=nv;}
	g[c[i]][id]=0;
	}
	if (s[c[1]]!=pos) rev(c[1]);
	if (t[c[2]]!=pos) rev(c[2]);
	bl[c[1]]=1;
	int ns=s[c[2]],nt=t[c[1]],i,sz=p[c[1]].size();
	s[c[2]]=ns;t[c[2]]=nt;
	for (i=0;i<sz;i++) p[c[2]].pb(p[c[1]][i]);
	memset(g[c[2]],0,sizeof(g[c[2]]));
	dfs(ns,0,nt,c[2]);
	for (i=1;i<=m;i++)
	{if (bl[i]) continue;
	if (s[i]==t[i]) bl[i]=1;
	}
	}
	printf ("%d\n",ans);
	for (i=1;i<=m;i++) printf ("%d %d\n",rs[i],rt[i]);
	return 0;
}