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<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=(int)j;i<=(int)k;++i)
#define Forr(i,j,k) for (int i=(int)j;i>=(int)k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T &a,T b) { return a<b?a=b,1:0; }
template<typename T>bool chkmin(T &a,T b) { return a>b?a=b,1:0; }

const int maxn=4000+10;
struct EDGE {
	int to,nxt;
}e[maxn];
int n,m;
int tot=1,Ans;
int head[maxn],cnt[maxn],U[maxn],V[maxn],vis[maxn],Vis[maxn];
vector<int>Edge[maxn],Path[maxn];

inline void file() {
	freopen("AGC025E.in","r",stdin);
	freopen("AGC025E.out","w",stdout);
}

inline int read() {
	int x=0,p=1;
	char c=getchar();
	while (!isdigit(c)) { if (c=='-') p=-1; c=getchar();}
	while (isdigit(c)) { x=(x<<1)+(x<<3)+(c-'0'); c=getchar();}
	return x*p;
}

inline void add(int from,int to) {
	e[++tot]=(EDGE){to,head[from]}; head[from]=tot;
	e[++tot]=(EDGE){from,head[to]}; head[to]=tot;
}

int dfs(int u,int fa,int t,vector<int>& E) {
	if (u==t) return 1;
	for (int i=head[u];i!=0;i=e[i].nxt) {
		int v=e[i].to;
		if (v==fa) continue;
		E.push_back(i);
		if (dfs(v,u,t,E)) return 1;
		E.pop_back();
	}
	return 0;
}

int main() {
//	file();
	n=read(); m=read();
	For (i,1,n-1) {
		int x=read(),y=read(); add(x,y);
	}
	For (i,1,m) {
		U[i]=read(); V[i]=read();
		dfs(U[i],0,V[i],Edge[i]);
		For (j,0,Edge[i].size()-1)
			++cnt[Edge[i][j]/2],Path[Edge[i][j]/2].push_back(i);
	}
	For (i,1,n-1) Ans+=min(2,cnt[i]);
	while (1) {
		int p=0;
		For (j,1,n-1)
			if (cnt[j]==1 && vis[j<<1]^vis[j<<1|1]) {
				p=vis[j<<1]?j<<1|1:j<<1; break;
			}
		if (!p) {
			For (j,1,n-1)
				if (cnt[j]) {
					p=vis[j<<1]?j<<1|1:j<<1; break;
				}
			if (!p) break;
		}
		int q=p/2;
		while (Vis[Path[q].back()]) Path[q].pop_back();
		int E=Path[q].back(),flag=0;
		Vis[E]=1;
		For (i,0,Edge[E].size()-1)
			if (Edge[E][i]/2==q) flag=(Edge[E][i]==p);
		if (!flag) {
			swap(U[E],V[E]);
			For (i,0,Edge[E].size()-1) Edge[E][i]^=1;
		}
		For (i,0,Edge[E].size()-1)
			--cnt[Edge[E][i]/2],vis[Edge[E][i]]=1;
	}
	printf("%d\n",Ans);
	For (i,1,m) printf("%d %d\n",U[i],V[i]);
	return 0;
}