Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=2010, LOG=20;

int n, m, ted, k, u, v, x, y, t, a, b, ans;
int A[MAXN*2], B[MAXN*2], out[MAXN*2][2];
bool dead[MAXN];
int deg[MAXN];
int par[MAXN], h[MAXN], sum[MAXN];
int lca[MAXN][MAXN];
vector<int> G[MAXN], vec[MAXN];

void dfs1(int node){
	h[node]=h[par[node]]+1;
	for (int v:G[node]) if (v!=par[node]) par[v]=node, dfs1(v);
}
int Lca(int x, int y){
	if (x==y) return x;
	if (h[x]<h[y]) swap(x, y);
	if (lca[x][y]) return lca[x][y];
	return lca[x][y]=Lca(par[x], y);
}
int dfs2(int node){
	for (int v:G[node]) if (v!=par[node]) sum[node]+=dfs2(v);
	return sum[node];
}

void Solve(){
//	debug("FUCK")
	int v=0, u;
	for (int i=1; i<=n && !v; i++) if (deg[i]==1) v=i;
	if (!v) return ;
	dead[v]=1;
	for (int i:G[v]) if (!dead[i]) u=i;
	deg[u]--;
	deg[v]--;
	sort(all(vec[v]));
	vector<int> tmp;
	for (int x:vec[v]){
		if (tmp.empty() || tmp.back()!=x) tmp.pb(x);
		else tmp.pop_back();
	}
	
//	debug2(v, u)
//	debugv(tmp)
	
	if (tmp.size()==0){
		Solve();
		return ;
	}
	int is2=0, x, y, id, X, Y;
	if (tmp.size()>=2){
		x=tmp.back();
		tmp.pop_back();
		y=tmp.back();
		tmp.pop_back();
		is2=1;
	}
	
	if (is2){
		id=++ted;
		A[id]=X=(A[x]^B[x]^v);
		B[id]=Y=(A[y]^B[y]^v);
		vec[X].pb(id);
		vec[Y].pb(id);
		vec[X].pb(x);
		vec[Y].pb(y);
	}
	
	vector<int> shit;
	for (int i=0; i<tmp.size(); i++){
		int id=tmp[i];
		if (A[id]==v) A[id]=u;
		if (B[id]==v) B[id]=u;
		vec[u].pb(id);
		if (A[id]==B[id]) out[id][0]=u, out[id][1]=v, shit.pb(0);
		else shit.pb(1);
	}
	Solve();
	if (is2){
		if (out[id][0]==X){
			out[x][0]=X;
			out[x][1]=v;
			out[y][0]=v;
			out[y][1]=Y;
		}
		else{
			out[y][0]=Y;
			out[y][1]=v;
			out[x][0]=v;
			out[x][1]=X;
		}
	}
	for (int i=0; i<tmp.size(); i++){
		if (shit[i]){
			int id=tmp[i];
			if (out[id][0]==u) out[id][0]=v;
			if (out[id][1]==u) out[id][1]=v;
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>m;
	for (int i=1; i<n; ++i){
		cin>>u>>v;
		G[u].pb(v);
		G[v].pb(u);
		deg[u]++;
		deg[v]++;
	}
	dfs1(1);
	for (int i=1; i<=m; i++){
		cin>>A[i]>>B[i];
		vec[A[i]].pb(i);
		vec[B[i]].pb(i);
		sum[A[i]]++;
		sum[B[i]]++;
		sum[Lca(A[i], B[i])]-=2;
	}
	dfs2(1);
	for (int i=2; i<=n; i++) ans+=min(sum[i], 2);
	ted=m;
	Solve();
	cout<<ans<<"\n";
	for (int i=1; i<=m; i++) cout<<out[i][0]<<" "<<out[i][1]<<"\n";
	
	return 0;
}