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<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
struct bian{int nxt,to;}bi[4040];
int n,m,head[2020],num,tot,f[2020],d[2020],dep[2020],cnt[2020],ans,c[4040];
inline void add(int from,int to){bi[++num]=bian{head[from],to};head[from]=num;}
pair<int,int>b[4040],l[4040];
vector<int>E[2020];
vector<pair<int,int> >E1[4040];
bool bj[4040];
queue<int>q;
void ADD(int x,int y,int C)
{
//	printf("%d %d %d\n",x,y,C);
	E1[x].push_back(make_pair(y,C));
	E1[y].push_back(make_pair(x,C));
}
void dfs(int v,int fa)
{
	dep[v]=dep[fa]+1;f[v]=fa;
	for(int i=head[v],u;i;i=bi[i].nxt)
	{
		u=bi[i].to;
		if(u==fa)continue;
		dfs(u,v);++d[v];
	}
	if(!d[v])q.push(v);
}
void work(int x,int y,int id)
{
	while(x!=y)
	{
		if(dep[x]>dep[y])++cnt[x],E[x].push_back(id),x=f[x];
		else ++cnt[y],E[y].push_back(id),y=f[y];
	}
}
void erase(int x)
{
	int b1=0,b2=0,u,v;
	for(auto p:E[x])
		if(!bj[p])
		{
			if(!b1)b1=p;
			else if(!b2)
			{
				b2=p;
				u=l[b1].first==x?l[b1].second:l[b1].first;
				v=l[b2].first==x?l[b2].second:l[b2].first;
				if(u==v)ADD(b1,b2,(l[b1].first!=x)==(l[b2].first!=x));
				else
				{
					++tot;
				//	printf("%d %d\n",u,v);
					if(l[b1].first==x)ADD(b1,tot,1);
					else u=l[b1].first,ADD(b1,tot,0);
					if(l[b2].first==x)ADD(b2,tot,0);
					else ADD(b2,tot,1);
					l[tot]=make_pair(u,v);work(u,v,tot);
				}
				bj[b1]=bj[b2]=1;
			}
		}
	for(auto p:E[x])
		if(!bj[p])
		{
			if(l[p].first==f[x]||l[p].second==f[x])continue;
			else
			{
				if(l[p].first==x)l[p].first=f[x];
				else l[p].second=f[x];
			}
		}
}
void dfs1(int v,bool C)
{
	c[v]=C+1;
	for(auto u:E1[v])if(!c[u.first])dfs1(u.first,C^u.second);
}
int main()
{
	scanf("%d %d",&n,&m);
	int x,y;
	for(int i=1;i<n;++i)
	{
		scanf("%d %d",&x,&y);
		add(x,y),add(y,x);
	}
	dfs(1,0);
	for(int i=1;i<=m;++i)scanf("%d %d",&b[i].first,&b[i].second),work(b[i].first,b[i].second,i),l[i]=b[i];tot=m;
	for(int i=1;i<=n;++i)ans+=min(cnt[i],2);
	printf("%d\n",ans);
	while(!q.empty())
	{
		x=q.front();q.pop();
		erase(x);
		--d[f[x]];
		if(!d[f[x]])q.push(f[x]);
	}
	for(int i=1;i<=tot;++i)if(!c[i])dfs1(i,0);
	for(int i=1;i<=m;++i)
	{
		if(c[i]==2)swap(b[i].first,b[i].second);
		printf("%d %d\n",b[i].first,b[i].second);
	}
	return 0;
}