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;
const int NMax = 1010000;
struct edge {
  int num, id;
  edge *next;
} * G[NMax], pool[NMax];
int L;
void Build(int first, int second, int id) {
  edge *p = &pool[L++], *q = &pool[L++];
  p->num = second;
  p->next = G[first];
  G[first] = p;
  q->num = first;
  q->next = G[second];
  G[second] = q;
  p->id = q->id = id;
}
int N, father[NMax], nn1, nn2;
pair<int, int> Es[NMax], Et[NMax];
map<pair<int, int>, int> E1, E2;
int Find(int a) {
  int R;
  for (R = a; father[R] != -1; R = father[R])
    ;
  int tmp;
  while (father[a] != -1) {
    tmp = father[a];
    father[a] = R;
    a = tmp;
  }
  return R;
}
void Union(int a, int b) {
  int first = Find(a), second = Find(b);
  if (first != second) father[first] = second;
}
int root, dep[NMax];
multiset<int> *S[NMax];
void DFS(int a, int fa, int d) {
  dep[a] = d;
  for (edge *p = G[a]; p; p = p->next)
    if (p->num != fa) DFS(p->num, a, d + 1);
}
int have[NMax];
void DFS1(int a, int fa) {
  for (edge *p = G[a]; p; p = p->next)
    if (p->num != fa) {
      DFS1(p->num, a);
      int pn = Find(p->num);
      int tmp = *(S[pn]->begin());
      while (have[tmp]) {
        S[pn]->erase(*(S[pn]->begin()));
        tmp = *(S[pn]->begin());
      }
      have[tmp] = 1;
      printf("%d %d %d %d\n", Es[p->id].first, Es[p->id].second, Et[tmp].first,
             Et[tmp].second);
      int a1 = Find(Et[tmp].second);
      if (a1 == pn) a1 = Find(Et[tmp].first);
      if (S[a1]->size() < S[pn]->size()) swap(S[a1], S[pn]);
      Union(pn, a1);
      for (multiset<int>::iterator p1 = S[pn]->begin(); p1 != S[pn]->end();
           p1++)
        if (!have[*p1]) S[a1]->insert(*p1);
      delete S[pn];
      S[pn] = NULL;
    }
}
int main() {
  memset(father, -1, sizeof(father));
  scanf("%d", &N);
  for (int i = 1; i < N; i++) {
    int first, second;
    scanf("%d%d", &first, &second);
    if (first > second) swap(first, second);
    E1[make_pair(first, second)] = 1;
    Es[++nn1] = make_pair(first, second);
  }
  int step = 0;
  for (int i = 1; i < N; i++) {
    int first, second;
    scanf("%d%d", &first, &second);
    if (first > second) swap(first, second);
    E2[make_pair(first, second)] = 1;
    if (E1[make_pair(first, second)])
      Union(first, second);
    else
      Et[++nn2] = make_pair(first, second), step++;
  }
  printf("%d\n", step);
  for (int i = 1; i <= nn1; i++)
    if (Find(Es[i].first) != Find(Es[i].second))
      Build(Find(Es[i].first), Find(Es[i].second), i);
  root = Find(N / 2);
  DFS(root, -1, 0);
  for (int i = 1; i <= N; i++) S[i] = new multiset<int>;
  for (int i = 1; i <= nn2; i++) {
    if (dep[Find(Et[i].first)] < dep[Find(Et[i].second)])
      swap(Et[i].first, Et[i].second);
    S[Find(Et[i].first)]->insert(i);
    S[Find(Et[i].second)]->insert(i);
  }
  DFS1(root, -1);
  getchar();
  getchar();
  return 0;
}