Problem: My name is James diGriz, I'm the most clever robber and treasure hunter in the whole galaxy. There are books written about my adventures and songs about my operations, though you were able to catch me up in a pretty awkward moment.

I was able to hide from cameras, outsmart all the guards and pass numerous traps, but when I finally reached the treasure box and opened it, I have accidentally started the clockwork bomb! Luckily, I have met such kind of bombs before and I know that the clockwork mechanism can be stopped by connecting contacts with wires on the control panel of the bomb in a certain manner.

I see n contacts connected by n - 1 wires. Contacts are numbered with integers from 1 to n. Bomb has a security mechanism that ensures the following condition: if there exist k ≥ 2 contacts c1, c2, ..., ck forming a circuit, i. e. there exist k distinct wires between contacts c1 and c2, c2 and c3, ..., ck and c1, then the bomb immediately explodes and my story ends here. In particular, if two contacts are connected by more than one wire they form a circuit of length 2. It is also prohibited to connect a contact with itself.

On the other hand, if I disconnect more than one wire (i. e. at some moment there will be no more than n - 2 wires in the scheme) then the other security check fails and the bomb also explodes. So, the only thing I can do is to unplug some wire and plug it into a new place ensuring the fact that no circuits appear.

I know how I should put the wires in order to stop the clockwork. But my time is running out! Help me get out of this alive: find the sequence of operations each of which consists of unplugging some wire and putting it into another place so that the bomb is defused. 

Input

The first line of the input contains n (2 ≤ n ≤ 500 000), the number of contacts.

Each of the following n - 1 lines contains two of integers xi and yi (1 ≤ xi, yi ≤ n, xi ≠ yi) denoting the contacts currently connected by the i-th wire.

The remaining n - 1 lines contain the description of the sought scheme in the same format.

It is guaranteed that the starting and the ending schemes are correct (i. e. do not contain cicuits nor wires connecting contact with itself).

Output

The first line should contain k (k ≥ 0) — the minimum number of moves of unplugging and plugging back some wire required to defuse the bomb.

In each of the following k lines output four integers ai, bi, ci, di meaning that on the i-th step it is neccesary to unplug the wire connecting the contacts ai and bi and plug it to the contacts ci and di. Of course the wire connecting contacts ai and bi should be present in the scheme.

If there is no correct sequence transforming the existing scheme into the sought one, output -1.

Examples

Input

3
1 2
2 3
1 3
3 2


Output

1
1 2 1 3


Input

4
1 2
2 3
3 4
2 4
4 1
1 3


Output

3
1 2 1 3
4 3 4 1
2 3 2 4

Note

Picture with the clarification for the sample tests:

<image>

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

/**
 * @auther chao
 * @date 16/4/03
 */
public class CF0327 {

    static PrintWriter pw = new PrintWriter(System.out);
    static int[] root;
    static int[] cache;
    static int[] targets;
    static int mt;
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        root = new int[n];
        cache = new int[n];
        targets = new int[n];
        mt = 0;
        int[][] sNodes = init(br, n);
        int[][] tNodes = init(br, n);
        int[] sParents = new int[n];
        int[] tParents = new int[n];
        dfs(tNodes, tParents, 0, -1);
        dfs2(sNodes, sParents, 0, -1, tParents);
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (root[i] == i) {
                cnt++;
            }
        }
        pw.println(cnt-1);
        dfs3(sParents, tParents);
        pw.close();

    }

    private static int[][] init(BufferedReader br, int n) throws IOException {
        String[] s;
        Edge[] edges = new Edge[n-1];
        int[] degree = new int[n];
        for (int i = 0; i < edges.length; i++) {
            s = br.readLine().split(" ");
            int x = Integer.parseInt(s[0])-1;
            int y = Integer.parseInt(s[1])-1;
            edges[i] = new Edge(x, y);
            degree[x]++;
            degree[y]++;
        }
        int[][] nds = new int[n][];
        for (int i = 0; i < n; i++) {
            nds[i] = new int[degree[i]];
        }
        for (Edge edge : edges) {
            nds[edge.x][--degree[edge.x]] = edge.y;
            nds[edge.y][--degree[edge.y]] = edge.x;
        }
        return nds;
    }

    private static void dfs(int[][] nodes, int[] parents, int current, int parent) {
        parents[current] = parent;
        targets[mt++] = current;
        for (int child : nodes[current]){
            if (child == parent) continue;
            dfs(nodes, parents, child, current);
        }
    }

    private static void dfs2(int[][] nodes, int[] sParents, int current, int parent, int[] tParents) {
        sParents[current] = parent;
        root[current] = current;
        for (int child : nodes[current]) {
            if (child == parent) continue;
            dfs2(nodes, sParents, child, current, tParents);
            if ((tParents[child] == current || tParents[current] == child)) {
                root[child] = current;
            }
        }
    }

    private static void dfs3(int[] sParents, int[] tParents) {
        for (int i = 0; i < mt; i++) {
            int current = targets[i];
            int parent = tParents[current];
            if (parent != -1 && getRoot(parent) != getRoot(current)) {
                int r = getRoot(current);
                root[getRoot(parent)] = r;
                pw.println((r + 1) + " " + (sParents[r] + 1) + " " + (parent + 1) + " " + (current + 1));
            }
        }
    }

    /*
    private static int getRoot(int p) {
    private static void dfs3(int[][] nodes, int[] sParents, int current, int parent, int[] tParents) {
        for (int child : nodes[current]) {
            if (child == parent) continue;
            dfs3(nodes, sParents, child, current, tParents);
        }
        int pp = tParents[current];
        if (pp != -1 && (sParents[current] != pp && sParents[pp] != current && getRoot(pp) != getRoot(current))) {
            int r = getRoot(current);
            root[getRoot(pp)] = r;
            pw.println((r+1)+" "+(sParents[r]+1)+" "+(pp+1)+" "+(current+1));
        }

    }*/

    private static int getRoot(int p) {
        if (root[p] == p) {
            return p;
        }
        int n = 0;
        while (root[p] != p) {
            cache[n++] = p;
            p = root[p];
        }
        for (int i = 0; i < n; i++) {
            root[cache[i]] = p;
        }
        return p;
    }

}
class Edge{
    int x, y;
    public Edge(int x, int y) {
        this.x = x;
        this.y = y;
    }
}