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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Stack;
import java.util.StringTokenizer;

// Codeforces Round #345 (Div. 1)
// Clockwork Bomb
public class Problem_650_E {
    

    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        Problem_650_E solver = new Problem_650_E();
        solver.solve(1, new InputStreamReader(inputStream), out);
        out.close();
    }

    class UnionFind {
      int[] rank;

      int[] parent;

      int n;

      int count;

      UnionFind(int size)
      {
        count = size;
        n = size;
        rank = new int[n];
        parent = new int[n];
        for(int i = 0; i < n; i++)
          parent[i] = i;
      }

      void merge(int a, int b)
      {
        int pa = find(a);
        int pb = find(b);

        if(pa == pb)
          return;

        if(rank[pa] > rank[pb]) {
          parent[pb] = pa;
          rank[pb] += rank[pa];
        } else {
          parent[pa] = pb;
          rank[pa] += rank[pb];
        }
        count--;
      }

      int find(int a)
      {
        if(a != parent[a])
          parent[a] = find(parent[a]);
        return parent[a];
      }

      int count()
      {
        return count;
      }
    }

    static class Pair implements Comparable<Pair> {
      int first;

      int second;

      Pair(int f, int s)
      {
        first = f;
        second = s;
      }

      public int compareTo(Pair o)
      {
        int r = first - o.first;

        if(r == 0)
          r = second - o.second;

        return r;
      }
      
      @Override
      public boolean equals(Object obj)
      {
        Pair o = (Pair)obj;
        return compareTo(o) == 0;
      }
      
      @Override
      public int hashCode()
      {
        return first << 8 + second;
      }
    }
    

    static class Graph {
      Edge[] edges;

      int nvertices;

      Graph(int n)
      {
        edges = new Edge[n];
        nvertices = n;
      }

      void addEdge(int from, int to)
      {
        Edge e = new Edge();
        e.to = to;
        e.next = edges[from];
        edges[from] = e;
      }
    }

    static class Edge {
      int to;

      Edge next;
    }

    Graph g1;
    Graph g2;
    UnionFind uf;
    ArrayList<Pair> edges = new ArrayList<>();
    Pair[] parent;
    
    static class Node {
      int p;
      int x;
    }
    
    void dfs1(int p, int x)
    {
      Node n = new Node();
      n.p = p;
      n.x = x;
      Stack<Node> s = new Stack<>();
      s.add(n);
      
      while(!s.isEmpty()) {
        Node top = s.pop();
        
        Edge e = g1.edges[top.x];
        while(e != null) {
          int y = e.to;
          if(y != top.p) {
            if(uf.find(y) != uf.find(top.x)) 
              edges.add(new Pair(top.x, y));
            n = new Node();
            n.p = top.x;
            n.x = y;
            s.add(n);
          }
          e = e.next;
        }
      }
    }

    void dfs2(int p, int x) {
      Stack<Node> s = new Stack<>();
      Node n = new Node();
      n.x = x;
      n.p = p;
      s.add(n);
      while(!s.isEmpty()) {
        Node top = s.pop();
        
        Edge e = g2.edges[top.x];
        while(e != null) {
          int y = e.to;
          if(y != top.p) {
            if(uf.find(y) != uf.find(top.x)){
              int ry = uf.find(y);
              parent[ry] = new Pair(top.x, y);
            }
            n = new Node();
            n.p = top.x;
            n.x = y;
            s.add(n);
          }
          e = e.next;
        }
      }
    }
    
    public void solve(int test, Reader input, PrintWriter out)
    {
        MyScanner in = new MyScanner(input);
        
        int n = in.nextInt();
        
        HashSet<Pair> set = new HashSet<>();
        
        g1 = new Graph(n);
        
        for(int i = 0; i < n - 1; i++) {
          int a = in.nextInt() - 1;
          int b = in.nextInt() - 1;
          if(a > b) {
            int t = a;
            a = b;
            b = t;
          }
          
          g1.addEdge(a, b);
          g1.addEdge(b, a);
          set.add(new Pair(a, b));
        }
        
        uf = new UnionFind(n);
        g2 = new Graph(n);
        parent = new Pair[n];
        
        Pair temp = new Pair(0, 0);
        for(int i = 0; i < n - 1; i++) {
          int a = in.nextInt() - 1;
          int b = in.nextInt() - 1;
          if(a > b) {
            int t = a;
            a = b;
            b = t;
          }
          g2.addEdge(a, b);
          g2.addEdge(b, a);
          temp.first = a;
          temp.second = b;
          if(set.contains(temp))
              uf.merge(a, b);
        }
        
        dfs1(-1, 0);
        dfs2(-1, 0);
        
        int k = edges.size();
        out.println(k);
        
        
        for(int i = k - 1; i >= 0; i--) {
          Pair p = edges.get(i);
          int a = p.first;
          int b = p.second;
          int r = uf.find(b);
          p = parent[r];
          int c = p.first;
          int d = p.second;
          out.printf("%d %d %d %d\n", a + 1, b + 1, c + 1, d + 1);
        }
    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner(Reader reader) {
            br = new BufferedReader(reader);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        
        int[] nextIntArray(int n)
        {
            int[] r = new int[n];
            for(int i = 0; i < n; i++)
                r[i] = nextInt();
            return r;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------

}