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<vector>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=10002;
int n,m,a,b,i,j,k,h[N],t[N],v[N];
int x[N],y[N],X[N],Y[N],fa[N],dep[N],val[N],ac[N];
int ans,id[N],d,l,r,cnt[2002],vis[N],col[N],oa,ob;
vector<int>e[N],w[N];
void add(int a,int b){
	t[++k]=h[a];h[a]=k;v[k]=b;
}
void dfs(int i){
	for(int j=h[i];j;j=t[j])
		if(v[j]!=fa[i]){
			fa[v[j]]=i;
			dep[v[j]]=dep[i]+1;
			dfs(v[j]);
		}
}
//clear x[i]==y[i];
void init(){
	scanf("%d%d",&n,&m);
	for(i=1;i<n;i++){
		scanf("%d%d",&a,&b);
		add(a,b);
		add(b,a);
	}
	dfs(1);
	for(i=1;i<=m;i++){
		//ac[i]=i;ac[i+m]=i+m;???
		scanf("%d%d",x+i,y+i);
		X[i]=x[i];Y[i]=y[i];
		a=x[i];b=y[i];
		while(a!=b){
			if(dep[a]>dep[b]){
				val[a]++;
				a=fa[a];
			}
			else{
				val[b]++;
				b=fa[b];
			}
		}
	}
	for(i=1;i<=n;i++){
		if(val[i]>2)
			val[i]=2;
		ans+=val[i];
	}
	printf("%d\n",ans);
	for(i=1;i<=n;i++)
		id[i]=i;
}
bool cmp(int x,int y){
	return dep[x]>dep[y];
}
void Cover(int x,int y){
	while(x!=y){
		if(dep[x]>dep[y]){
			cnt[x]++;
			x=fa[x];
		}
		else{
			cnt[y]++;
			y=fa[y];
		}
	}
}
void Adde(int a,int b,int c){
	e[a].push_back(b);
	w[a].push_back(c);
	e[b].push_back(a);
	w[b].push_back(c);
}
void D(int i){
	vis[i]=1;
	for(int j=0;j<e[i].size();j++)
		if(!vis[e[i][j]]){
			col[e[i][j]]=col[i]^w[i][j];
			D(e[i][j]);
		}
}
void work(){
	sort(id+1,id+n+1,cmp);
	for(i=1;i<=n;i++){
		k=id[i];
		if(val[k]<2){
			for(d=1;d<=m;d++){
				if(x[d]==k)x[d]=fa[x[d]];
				if(y[d]==k)y[d]=fa[y[d]];
			}
			val[k]=0;
		}
		else{
			a=b=0;
			for(d=1;d<=m;d++){
				if(x[d]==k||y[d]==k){
					if(!a){
						a=d;
						if(x[d]==k)oa=1;
						else oa=0;
					}
					else{
						b=d;
						if(x[d]==k)ob=1;
						else ob=0;
					}
				}
			}
			if(a==0||b==0||x[a]==0||y[a]==0||x[b]==0||y[b]==0)
				break;
			Adde(a,b,oa^ob^1);
			memset(cnt,0,sizeof(cnt));
			Cover(x[a],y[a]);
			Cover(x[b],y[b]);
			for(d=1;d<=n;d++)
				if(cnt[d]==2)
					val[d]=0;
			if(x[a]==k){
				x[a]^=x[b]^y[b];
			}
			else{
				y[a]^=x[b]^y[b];
			}
			x[b]=y[b]=0;
			for(d=1;d<=m;d++){
				if(x[d]==k)x[d]=fa[x[d]];
				if(y[d]==k)y[d]=fa[y[d]];
			}
		}
		for(d=1;d<=m;d++)
			if(x[d]==y[d]){
				x[d]=y[d]=0;
			}
	}
	for(i=1;i<=m;i++)
		if(!vis[i])
			D(i);
	for(i=1;i<=m;i++)
		if(col[i]==0)
			printf("%d %d\n",X[i],Y[i]);
		else
			printf("%d %d\n",Y[i],X[i]);			
}
int main(){
	init();
	work();
	return 0;
}