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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chkmin(T& x, U y) {
  if (y < x) x = y;
}
const int nil = 0;
int n;
vector<int> con[500105];
map<int, bool> M[2][500105];
int a[500105], b[500105];
pair<int, int> c[500105], d[500105];
struct Complex {
  pair<int, int> edge;
  int val, mi, ma;
  bool reverse;
  int son[2], father;
  void Reverse() {
    reverse ^= 1;
    swap(mi, ma);
    swap(son[0], son[1]);
  }
  bool Check();
  void PushDown();
  void PushUp();
  void clear(int i);
} tree[500105];
bool Complex::Check() { return tree[father].son[1] == val; }
void Complex::clear(int i) {
  reverse = 0;
  son[0] = son[1] = father = nil;
  edge = pair<int, int>(-1, -1);
  val = mi = ma = i;
}
void Complex::PushDown() {
  if (reverse) {
    tree[son[0]].Reverse();
    tree[son[1]].Reverse();
    reverse = 0;
  }
}
int exist(int a, int b) { return M[1][a].count(b); }
void Complex::PushUp() {
  edge = pair<int, int>(-1, -1);
  mi = ma = val;
  if (son[0] != nil) {
    mi = tree[son[0]].mi;
    if (edge.first == -1) {
      if (tree[son[0]].edge.first != -1) {
        edge = tree[son[0]].edge;
      } else {
        int a = tree[son[0]].ma;
        if (!exist(a, val)) edge = pair<int, int>(a, val);
      }
    }
  }
  if (son[1] != nil) {
    ma = tree[son[1]].ma;
    if (edge.first == -1) {
      if (tree[son[1]].edge.first != -1) {
        edge = tree[son[1]].edge;
      } else {
        int a = tree[son[1]].mi;
        if (!exist(a, val)) edge = pair<int, int>(a, val);
      }
    }
  }
}
inline void Rotate(int a, bool dir);
inline void Splay(int a);
inline void PushPath(int a);
inline void Access(int a);
inline void ToRoot(int a);
inline void Link(int x, int y);
inline void Cut(int x, int y);
inline void Modify(int a, int c);
inline int Ask(int x, int y);
inline int FindRoot(int x);
int main() {
  scanf("%d", &n);
  tree[0].clear(0);
  for (int i = 0; i <= n; i++) tree[i].clear(i);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    Link(u, v);
    M[0][u][v] = 1;
    M[0][v][u] = 1;
  }
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d", a + i, b + i);
    M[1][a[i]][b[i]] = 1;
    M[1][b[i]][a[i]] = 1;
  }
  int rn = 0;
  for (int i = 0; i < n - 1; i++) {
    int u = a[i], v = b[i];
    if (M[0][u].count(v)) continue;
    ToRoot(u);
    Access(v);
    Splay(v);
    pair<int, int> x = tree[v].edge;
    Cut(x.first, x.second);
    M[1][x.first].erase(x.second);
    M[1][x.second].erase(x.first);
    c[rn] = x;
    d[rn++] = pair<int, int>(u, v);
    Link(u, v);
  }
  printf("%d\n", rn);
  for (int i = 0; i < rn; i++) {
    printf("%d %d %d %d\n", c[i].first, c[i].second, d[i].first, d[i].second);
  }
  return 0;
}
inline void Rotate(int a, bool dir) {
  int f = tree[a].father;
  tree[f].son[!dir] = tree[a].son[dir];
  tree[tree[f].son[!dir]].father = f;
  tree[a].son[dir] = f;
  tree[a].father = tree[f].father;
  if (tree[tree[f].father].son[0] == f || tree[tree[f].father].son[1] == f)
    tree[tree[f].father].son[tree[f].Check()] = a;
  tree[f].father = a;
  tree[f].PushUp();
}
inline void Splay(int a) {
  PushPath(a);
  while (a == tree[tree[a].father].son[0] || a == tree[tree[a].father].son[1]) {
    int p = tree[tree[a].father].father;
    if (tree[p].son[0] != tree[a].father && tree[p].son[1] != tree[a].father)
      Rotate(a, !tree[a].Check());
    else if (!tree[tree[a].father].Check()) {
      if (!tree[a].Check())
        Rotate(tree[a].father, true), Rotate(a, true);
      else
        Rotate(a, false), Rotate(a, true);
    } else {
      if (tree[a].Check())
        Rotate(tree[a].father, false), Rotate(a, false);
      else
        Rotate(a, true), Rotate(a, false);
    }
  }
  tree[a].PushUp();
}
inline void PushPath(int a) {
  static int stack[500105];
  int top = 0;
  for (; tree[tree[a].father].son[0] == a || tree[tree[a].father].son[1] == a;
       a = tree[a].father)
    stack[++top] = a;
  stack[++top] = a;
  while (top) tree[stack[top--]].PushDown();
}
inline void Access(int a) {
  int last = nil;
  while (a != nil) {
    Splay(a);
    tree[a].son[1] = last;
    tree[a].PushUp();
    last = a;
    a = tree[a].father;
  }
}
inline void ToRoot(int a) {
  Access(a);
  Splay(a);
  tree[a].Reverse();
}
inline void Link(int x, int y) {
  ToRoot(x);
  tree[x].father = y;
}
inline void Cut(int x, int y) {
  ToRoot(x);
  Access(y);
  Splay(y);
  tree[y].son[0] = nil;
  tree[x].father = nil;
  tree[y].PushUp();
}
inline int FindRoot(int a) {
  while (tree[a].father != nil) a = tree[a].father;
  return a;
}