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;
const int N=4010;
int w[N],ne[N],la[N],t=1,ban[N];
void link(int x,int y){
	w[++t]=y;
	ne[t]=la[x];
	la[x]=t;
}
int n,m;
int pu[N],pv[N],res[N];
int px[N],py[N],t1,tag[N],now,used[N],tnx[N];
vector<int> q[N];
int dfs(int x,int fa,int tar){
	if (x==tar)return 1;
	for (int y=la[x];y;y=ne[y]){
		int z=w[y];
		if (z==fa)continue;
		if (dfs(z,x,tar)){
			q[y/2].push_back(now);
			return 1;
		}
	}
	return 0;
}
int z1,z2,yy;
void find(int x,int fa){
	int cnt=0;
	for (int y=la[x];y;y=ne[y]){
		int z=w[y];
		if (z==fa||ban[y])continue;
		find(z,x);
		cnt++;
		if (z1==z)yy=y;
	}
	if (!cnt)z1=x,z2=fa;
}
int mrk[N],ans;
int go(int x,int fa,int tar){
	if (x==tar)return 1;
	for (int y=la[x];y;y=ne[y]){
		int z=w[y];
		if (z==fa)continue;
		if (go(z,x,tar)){
			mrk[y>>1]++;
			return 1;
		}
	}
	return 0;
}
int main(){
	cin>>n>>m;
	for (int i=1;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		link(x,y);
		link(y,x);
	}
	for (int i=1;i<=m;i++){
		now=i;
		scanf("%d%d",&pu[i],&pv[i]);
		px[i]=pu[i],py[i]=pv[i];
		dfs(px[i],0,py[i]);
	}t=m;
	for (int i=1;i<n;i++){
		find(1,0);
		if (tag[yy>>1])ans+=2;
		else {
			int cnt=0,d1=0,d2=0;
			for (auto x:q[yy>>1])
				if (!used[x])cnt++,d2=d1,d1=x;
			ans+=min(cnt,2);
			if (cnt>=2){
				used[d1]=used[d2]=1;
				memset(mrk,0,sizeof mrk);
				used[d1]=used[d2]=1;
				go(px[d1],0,py[d1]);
				go(px[d2],0,py[d2]);
				for (int i=1;i<n;i++)
					if (mrk[i]==2)tag[i]=1;
				int u=0,v=0;
				for (int i=1;i<=n;i++){
					int cnt=0;
					for (int y=la[i];y;y=ne[y])
						cnt+=mrk[y>>1]==1;
					if (cnt==1)v=u,u=i;
				}
				if (!u){
					if (px[d1]==px[d2])
						res[d2]=1;
				}
				else {
					px[++t]=u;
					py[t]=v;
					if (py[d1]==u||px[d1]==v)res[d1]=1;
					if (py[d2]==u||px[d2]==v)res[d2]=1;
					tnx[d1]=tnx[d2]=t;
					now=t;
					dfs(px[t],0,py[t]);
				}
			}
		}
		ban[yy]=ban[yy^1]=1;
		for (auto x:q[yy>>1]){
			if (px[x]==z1)px[x]=z2;
			if (py[x]==z1)py[x]=z2;
		}
	}
	cout<<ans<<endl;
	for (int i=t;i>=1;i--){
		if (tnx[i])res[i]^=res[tnx[i]];
	}
	for (int i=1;i<=m;i++){
		if (!res[i])printf("%d %d\n",pu[i],pv[i]);
		else printf("%d %d\n",pv[i],pu[i]);
	}
}