Problem: There are N cities in Bob's country connected by roads. Some pairs of cities are connected by public transport. There are two competing transport companies — Boblines operating buses and Bobrail running trains. When traveling from A to B, a passenger always first selects the mode of transport (either bus or train), and then embarks on a journey. For every pair of cities, there are exactly two ways of how to travel between them without visiting any city more than once — one using only bus routes, and the second using only train routes. Furthermore, there is no pair of cities that is directly connected by both a bus route and a train route.

You obtained the plans of each of the networks. Unfortunately, each of the companies uses different names for the same cities. More precisely, the bus company numbers the cities using integers from 1 to N, while the train company uses integers between N + 1 and 2N. Find one possible mapping between those two numbering schemes, such that no pair of cities is connected directly by both a bus route and a train route. Note that this mapping has to map different cities to different cities.

Input

The first line contains an integer N (2 ≤ N ≤ 10000), the number of cities.

N - 1 lines follow, representing the network plan of Boblines. Each contains two integers u and v (1 ≤ u, v ≤ N), meaning that there is a bus route between cities u and v.

N - 1 lines follow, representing the network plan of Bobrail. Each contains two integers u and v (N + 1 ≤ u, v ≤ 2N), meaning that there is a train route between cities u and v.

Output

If there is no solution, output a single line with the word "No".

If a solution exists, output two lines. On the first line, there should be the word "Yes". On the second line, there should be N integers P1, P2, ..., PN (N + 1 ≤ Pi ≤ 2N) — the mapping between the two numbering schemes. More precisely, for i ≠ j it should be Pi ≠ Pj, and for every direct bus route (i, j), there is no direct train route between (Pi, Pj).

If there are multiple solutions, you may print any of them.

Examples

Input

4
1 2
2 3
3 4
5 6
6 7
7 8


Output

Yes
6 8 5 7


Input

4
1 2
2 3
3 4
5 6
5 7
5 8


Output

No


Input

7
1 2
1 3
1 4
1 5
5 6
6 7
8 9
9 10
10 11
11 12
12 13
13 14


Output

Yes
9 14 11 12 13 10 8

Note

The first sample (bus lines in red and rail lines in blue):

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int const N = 10000;
int an[N + 1];
set<int> tr[2][N + 1];
struct V {
  int d, u, v;
  V(int a, int b) : d(a), u(b), v(1e9) {}
  V(int a, int b, int c) : d(a), u(b), v(c) {}
  bool operator<(V const &o) const {
    if (d == o.d) {
      if (u == o.u) return v < o.v;
      return u < o.u;
    }
    return d < o.d;
  }
};
set<V> vs[2];
inline bool ised(set<int> tr[], int a, int b) {
  return tr[a].find(b) != tr[a].end();
}
inline bool ok(vector<int> &v) {
  for (int i = 0; i < (int)(v.size()); ++i)
    for (auto it = tr[0][v[i]].begin(); it != tr[0][v[i]].end(); ++it)
      if (ised(tr[1], an[v[i]], an[*it])) return false;
  return true;
}
inline void er(int i, int v) {
  vs[i].erase(V(tr[i][v].size(), *tr[i][v].begin(), v));
}
void go(int n) {
  if (n <= 5) {
    vector<int> v;
    for (auto it = vs[0].begin(); it != vs[0].end(); ++it) v.push_back(it->v);
    sort(v.begin(), v.end());
    do {
      int i = 0;
      for (auto it = vs[1].begin(); it != vs[1].end(); ++it, ++i)
        an[v[i]] = it->v;
      if (ok(v)) break;
    } while (next_permutation(v.begin(), v.end()));
    return;
  }
  if (vs[0].rbegin()->d == n - 2 || vs[1].rbegin()->d == n - 2) {
    bool b = vs[1].rbegin()->d == n - 2;
    int lf[2], pa[2], m[2];
    int big = vs[b].rbegin()->v;
    lf[b] = vs[b].begin()->u == big ? vs[b].upper_bound(V(1, big))->v
                                    : vs[b].begin()->v;
    pa[b] = *tr[b][lf[b]].begin();
    m[b] = big;
    bool g = !b;
    lf[g] = vs[g].begin()->v;
    pa[g] = *tr[g][lf[g]].begin();
    for (auto it = vs[g].begin(); it != vs[g].end(); ++it)
      if (it->v != pa[g] && tr[g][it->v].find(pa[g]) == tr[g][it->v].end()) {
        m[g] = it->v;
        break;
      }
    if (b) {
      an[lf[0]] = m[1];
      an[pa[0]] = lf[1];
      an[m[0]] = pa[1];
    } else {
      an[lf[0]] = pa[1];
      an[pa[0]] = m[1];
      an[m[0]] = lf[1];
    }
    er(0, lf[0]);
    er(0, pa[0]);
    er(0, m[0]);
    er(1, lf[1]);
    er(1, pa[1]);
    er(1, m[1]);
    for (auto it1 = vs[0].begin(), it2 = vs[1].begin(); it1 != vs[0].end();
         ++it1, ++it2)
      an[it1->v] = it2->v;
    return;
  }
  int lf[2][2];
  for (int i = 0; i < (int)(2); ++i) {
    lf[i][0] = vs[i].begin()->v;
    lf[i][1] = vs[i].upper_bound(V(1, vs[i].begin()->u))->v;
    int big = vs[i].rbegin()->v;
    if (vs[i].rbegin()->d == n - 3 && *tr[i][lf[i][0]].begin() != big &&
        *tr[i][lf[i][1]].begin() != big)
      lf[i][1] = vs[i].lower_bound(V(1, big, 0))->v;
    er(i, lf[i][0]);
    er(i, lf[i][1]);
  }
  for (int i = 0; i < (int)(2); ++i)
    for (int j = 0; j < (int)(2); ++j)
      for (auto it = tr[i][lf[i][j]].begin(); it != tr[i][lf[i][j]].end();
           ++it) {
        vs[i].erase(V(tr[i][*it].size(), *tr[i][*it].begin(), *it));
        tr[i][*it].erase(lf[i][j]);
        vs[i].insert(V(tr[i][*it].size(), *tr[i][*it].begin(), *it));
      }
  go(n - 2);
  if (tr[1][lf[1][0]].find(an[*tr[0][lf[0][0]].begin()]) !=
          tr[1][lf[1][0]].end() ||
      tr[1][lf[1][1]].find(an[*tr[0][lf[0][1]].begin()]) !=
          tr[1][lf[1][1]].end())
    swap(lf[1][0], lf[1][1]);
  an[lf[0][0]] = lf[1][0];
  an[lf[0][1]] = lf[1][1];
}
int main() {
  int n;
  scanf("%d", &n);
  for (int z = 0; z < (int)(2); ++z)
    for (int i = 1; i < (int)(n); ++i) {
      int a, b;
      scanf("%d%d", &a, &b);
      if (z) a -= n, b -= n;
      tr[z][a].insert(b);
      tr[z][b].insert(a);
    }
  for (int z = 0; z < (int)(2); ++z)
    for (int i = 1; i < (int)(n + 1); ++i)
      vs[z].insert(V(tr[z][i].size(), *tr[z][i].begin(), i));
  for (int z = 0; z < (int)(2); ++z)
    if (vs[z].rbegin()->d == n - 1) {
      printf("No\n");
      return 0;
    }
  go(n);
  printf("Yes\n%d", an[1] + n);
  for (int i = 2; i < (int)(n + 1); ++i) printf(" %d", an[i] + n);
  printf("\n");
}