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;
typedef long long ll;
typedef unsigned long long ull;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=2005;
int xx[N],yy[N],father[N],jjj[N],ans,n,m,vis[N],rev[N],x[N],y[N];
vector<int> e[N];
void Swap(int x,int y){
	swap(xx[x],xx[y]); swap(yy[x],yy[y]); swap(rev[x],rev[y]);
}
inline int qiu(int x,int y){
	memset(jjj,0,sizeof(jjj)); 
	for(int i=x;i;i=father[i])jjj[i]=1; 
	for(int i=y;i;i=father[i])if(jjj[i])return i;
}
void dfs(int p,int fa){
	father[p]=fa;
	for(auto i:e[p])if(i!=fa)dfs(i,p);
}
void solve(int dep){
	if(dep==1)return;
	for(int i=1;i<=m;i++)if(xx[i]==yy[i]){
		Swap(i,m); m--; solve(dep); m++; Swap(i,m); return;
	}
	//puts("");
	//for(int i=1;i<=m;i++)cout<<xx[i]<<" jjl "<<yy[i]<<endl;
//	writeln(ans);
	for(int i=1;i<=n;i++)if(!vis[i]){
		int tot=0,v;
		for(auto j:e[i])if(!vis[j]){tot++; v=j;}
		if(tot==1){
			int u=i; tot=0;
			for(int i=1;i<=m;i++){
				if(yy[i]==u){ swap(xx[i],yy[i]);  solve(dep); rev[i]^=1; return;}
				if(xx[i]==u)tot++;
			} 
			//cout<<vis[i]<<" "<<i<<" wzp "<<tot<<endl;
			if(tot<2){
				vis[u]=1;
				if(tot==0)solve(dep-1);
				else{
					for(int i=1;i<=m;i++){
						if(xx[i]==u){xx[i]=v; solve(dep-1); return;}
					}
				}
				return;
			}else{
				for(int i=1;i<=m;i++)if(xx[i]==u){
					for(int j=i+1;j<=m;j++)if(xx[j]==u){
						xx[i]=yy[i]; yy[i]=yy[j]; Swap(j,m); m--;
						solve(dep);
						m++; Swap(j,m); rev[i]^=1; rev[j]^=rev[i]^1;  //cout<<i<<" "<<j<<" "<<rev[1]<<" "<<rev[2]<<" "<<rev[3]<<endl;
						return;
					}
				}
			}
		}
	}
}
int ddd[N];
int main(){
	n=read(); m=read();
	for(int i=1;i<n;i++){
		int s=read(),t=read();
		e[s].push_back(t); e[t].push_back(s);
	}
	dfs(1,0);
	for(int i=1;i<=m;i++){
		x[i]=read(); y[i]=read();
		xx[i]=x[i]; yy[i]=y[i];
		int t=qiu(x[i],y[i]);
		for(int j=x[i];j!=t;j=father[j])ddd[j]++;
		for(int j=y[i];j!=t;j=father[j])ddd[j]++;
	}
	for(int i=1;i<=n;i++)ans+=min(ddd[i],2);
	writeln(ans);
	solve(n);
	for(int i=1;i<=m;i++)if(rev[i])cout<<y[i]<<" "<<x[i]<<endl; else cout<<x[i]<<" "<<y[i]<<endl;
}