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<cctype>
#include<vector>
#include<algorithm>
using namespace std;

inline char nc(){ return getchar();static char buf[100000] , *p1,*p2; return p1 == p2 && (p2 = (p1 = buf) + fread(buf,1,100000,stdin),p1 == p2) ? EOF : *p1++;}
template<class T>inline void rd(T & x){ x = 0;char ch = nc(); for(;!isdigit(ch);ch = nc()); for(;isdigit(ch);ch = nc()) x = x * 10 - 48 + ch;}

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define debug(...) fprintf(stderr,__VA_ARGS__)

typedef pair<int,int> pii;

const int maxn = 4000 + 5;

int n,m,p,ans,s[maxn] , t[maxn] , deg[maxn] , dep[maxn] , par[maxn] , dis[maxn][maxn] , vis[maxn][maxn];
vector<int> adj[maxn] , pth[maxn];
bool del[maxn] , ers[maxn] ,rev[maxn];
vector<pii> bel[maxn];


void dfs(int u){
	for(int i = 0;i < adj[u].size();i++){
		int v = adj[u][i];
		if(v == par[u]) continue;
		par[v] = u;dep[v] = dep[u] + 1; dfs(v);
	}
} 

int Dis(int x,int y){
	if(x == y) return 0;
	if(dis[x][y]) return dis[x][y];
	return dep[x] >= dep[y] ? (dis[x][y] = Dis(par[x],y) + 1) : (dis[x][y] = Dis(x,par[y]) + 1);
}


inline void Add(int i,int x,int y){
	if(x == y) return ;
	s[i] = x;  t[i] = y;
	vector<int > l,r;
	int u = x,v = y;
	while(u != v){
		if(dep[u] >= dep[v]) l.pb(u) , u = par[u];
		else r.pb(v) , v = par[v];
	}
	reverse(r.begin() , r.end());
	for(int j = 0;j < l.size();j++) pth[i].pb(l[j]);
	pth[i].pb(u);
	for(int j = 0;j < r.size();j++) pth[i].pb(r[j]);
	for(int j = 0;j < pth[i].size();j++){
		bel[pth[i][j]].pb(mp(i,j));
		if(j < pth[i].size() - 1){
			int u = pth[i][j] , v = pth[i][j + 1];
			if(u > v) swap(u,v);
			if(vis[u][v] < 2) ++ vis[u][v] , ++ans;
		}
	}
}


inline bool check(int i,int j,int x){ return (j < pth[i].size() - 1 && pth[i][j + 1] == x) || (j && pth[i][j - 1] == x);}
inline int ad(int i,int j,int x) { return j < pth[i].size() - 1 && pth[i][j + 1] == x ? pth[i].back()  : pth[i][0];}
inline void work(int i,int x,int y){
	if(rev[i]) swap(x,y);
	if(Dis(s[i],x) + Dis(y,t[i]) + 1 != Dis(s[i],t[i])) rev[i] ^= 1;
}

void solve(){
	int x = 0;
	for(int i = 1;i <= n;i++) if(!ers[i] && deg[i] == 1)  x = i;
	if(!x) return;
	int y = 0;
	for(int i = 0;i < adj[x].size();i++) if(!ers[adj[x][i]]) y = adj[x][i];
	ers[x] = 1 , -- deg[y];
	pii a = mp(0,0) , b = mp(0,0);
	for(int i = 0;i < bel[x].size();i++){
		pii p = bel[x][i];
		if(!del[p.X] && check(p.X,p.Y,y)){
			if(a.X) b = p;
			else a = p;	
		}
	}
	if(!b.X) solve();
	else {
		work(a.X,y,x) ; work(b.X,x,y);
		Add(++p,ad(a.X,a.Y,y) , ad(b.X,b.Y,y));
		del[a.X] = del[b.X] = 1;
		int q = p; solve();
		rev[a.X] ^= rev[q] ; rev[b.X] ^= rev[q];
	}
}



int main(){
	rd(n); rd(m);
	for(int i = 1,u,v;i < n;i++){
		rd(u); rd(v);
		adj[u].pb(v) ; adj[v].pb(u);
		++deg[u] ; ++deg[v];
	}
	dfs(1);
	for(int i = 1,x,y;i <= m;i++){
		rd(x); rd(y);
		Add(++p,x,y);
	}
	printf("%d\n",ans);
	solve();
	for(int i = 1;i <= m;i++){
		if(rev[i]) swap(s[i],t[i]);
		printf("%d %d\n",s[i],t[i]);
	}
	return 0;
}
