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 <algorithm>
#include <functional>
#include <map>
using namespace std;

int main() {
        int n, m;
        scanf("%d%d", &n, &m);
        vector<vector<pair<int, int>>> g(n);
        for (int i = 0; i < n - 1; i ++) {
                int a, b;
                scanf("%d%d", &a, &b);
                a --, b --;
                g[a].push_back({b, i});
                g[b].push_back({a, i});
        }
        vector<vector<int>> wi(n);
        int tot = 2 * (n + m);
        vector<int> u(tot), v(tot);
        vector<int> ucut(tot), vcut(tot);
        for (int i = 0; i < m; i ++) {
                scanf("%d%d", &u[i], &v[i]);
                u[i] --, v[i] --;
                ucut[i] = u[i];
                vcut[i] = v[i];
                wi[u[i]].push_back(i);
                wi[v[i]].push_back(i);
        }

        int idx = m;
        vector<pair<int, int>> dir(tot);
        vector<bool> used(tot, false);
        function<void (int, int)> dfs = [&](int leaf, int prev) {
                for (auto e : g[leaf]) if (e.first != prev) {
                        dfs(e.first, leaf);
                }
                int pair = -1;
                for (auto i : wi[leaf]) if (!used[i]) {
                        if (ucut[i] == vcut[i]) {
                                continue;
                        }
                        if (pair == -1) {
                                pair = i;
                                continue;
                        }
                        used[pair] = used[i] = true;
                        int j = idx ++;
                        int pend = (leaf == ucut[pair] ? vcut[pair] : ucut[pair]);
                        int iend = (leaf == ucut[i   ] ? vcut[i   ] : ucut[i   ]);
                        // 適当に方向を定める
                        u[j] = ucut[j] = pend;
                        v[j] = vcut[j] = iend;
                        dir[j] = {pair, i};
                        wi[pend].push_back(j);
                        wi[iend].push_back(j);
                        pair = -1;
                }
                if (pair != -1) {
                        (leaf == ucut[pair] ? ucut[pair] : vcut[pair]) = prev;
                        wi[prev].push_back(pair);
                }
        };

        dfs(0, -1);
        vector<bool> rev(tot, false);

        for (int id = idx - 1; id >= m; id --) {
                int q1 = dir[id].first, q2 = dir[id].second;
                rev[q1] = rev[id] ^ (u[id] != ucut[q1]);
                rev[q2] = rev[id] ^ (v[id] != vcut[q2]);
        }

        // 実際に経路を辿ってカウントを数えている
        vector<int> cnt(n - 1);
        // uからvへのパスであるかどうかが返り値
        function<bool (int, int, int)> dfs2 = [&](int u, int v, int prev) {
                if (u == v) {
                        return true;
                }
                for (auto e : g[u]) if (e.first != prev) {
                        bool good = dfs2(e.first, v, u);
                        if (good) {
                                cnt[e.second] ++;
                                return true;
                        }
                }
                return false;
        };
        for (int i = 0; i < m; i ++) {
                if (rev[i]) {
                        swap(u[i], v[i]);
                }
                dfs2(u[i], v[i], -1);
        }
        int ans = 0;
        for (int i = 0; i < n - 1; i ++) {
                ans += min(2, cnt[i]);
        }
        printf("%d\n", ans);
        for (int i = 0; i < m; i ++) {
                printf("%d %d\n", u[i] + 1, v[i] + 1);
        }
        return 0;
}

