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;
struct tree {
  set<int> g[10100];
  set<pair<int, int>> degs;
  set<int> left;
  set<pair<int, int>> leafPs;
  set<int> leaves[10100];
  int n;
  int kstar() { return left.size() - degs.rbegin()->first - 1; }
  void init() {
    for (int i = 0; i < n; i++) left.insert(i);
    for (int i = 0; i < n; i++) degs.insert({g[i].size(), i});
    for (int i = 0; i < n; i++)
      if (g[i].size() == 1) {
        leaves[*g[i].begin()].insert(i);
      }
    for (int i = 0; i < n; i++) {
      if (leaves[i].size()) {
        leafPs.insert({leaves[i].size(), i});
      }
    }
  }
  void erase(int u) {
    degs.erase({g[u].size(), u});
    left.erase(u);
    int v = *g[u].begin();
    leafPs.erase({leaves[v].size(), v});
    leaves[v].erase(u);
    if (leaves[v].size() > 0) leafPs.insert({leaves[v].size(), v});
    degs.erase({g[v].size(), v});
    g[v].erase(u);
    degs.insert({g[v].size(), v});
    if (g[v].size() == 1) {
      int k = *g[v].begin();
      leafPs.erase({leaves[k].size(), k});
      leaves[k].insert(v);
      leafPs.insert({leaves[k].size(), k});
    }
  }
  int p(int u) { return *g[u].begin(); }
  pair<int, int> getTwo() {
    int q = degs.rbegin()->second;
    set<pair<int, int>>::reverse_iterator p = leafPs.rbegin();
    int a;
    if (leaves[q].size()) {
      a = *leaves[q].begin();
      if (p->second == q) p++;
    } else {
      a = *leaves[p->second].begin();
      p++;
    }
    int b = *leaves[p->second].begin();
    return {a, b};
  }
};
int sol[10100];
set<pair<int, int>> edges;
bool bad(int u, int v) { return edges.count({u, v}) + edges.count({v, u}); }
void solve_small(tree &a, tree &b) {
  int n = a.left.size();
  vector<int> perm;
  vector<int> as, bs;
  for (int u : a.left) as.push_back(u);
  for (int u : b.left) bs.push_back(u);
  for (int i = 0; i < n; i++) perm.push_back(i);
  while (true) {
    for (int i = 0; i < n; i++) sol[as[i]] = bs[perm[i]];
    bool ok = true;
    for (int u : as)
      for (int v : a.g[u])
        if (bad(sol[u], sol[v])) ok = false;
    if (ok) break;
    next_permutation(perm.begin(), perm.end());
  }
}
void solve_1(tree &a, tree &b, int norm) {
  int wa, wb;
  int ua, ub;
  int va, vb;
  wa = a.leafPs.rbegin()->second;
  ua = a.leafPs.begin()->second;
  va = *a.leaves[ua].begin();
  vb = b.leafPs.begin()->second;
  wb = *b.leaves[vb].begin();
  for (int u : b.left)
    if (u != wb && u != vb && b.g[u].count(wb) == 0 && b.g[u].count(vb) == 0)
      ub = u;
  vector<int> bs;
  for (int u : b.left)
    if (u != ub && u != vb && u != wb) bs.push_back(u);
  if (norm) {
    sol[wa] = wb;
    sol[ua] = ub;
    sol[va] = vb;
  } else {
    sol[wb] = wa;
    sol[ub] = ua;
    sol[vb] = va;
  }
  int i = 0;
  for (int u : a.left)
    if (u != ua && u != va && u != wa) {
      if (norm)
        sol[u] = bs[i++];
      else
        sol[bs[i++]] = u;
    }
}
void solve(tree &a, tree &b) {
  if (a.left.size() <= 5) {
    solve_small(a, b);
    return;
  }
  if (a.kstar() == 1) {
    solve_1(a, b, true);
    return;
  }
  if (b.kstar() == 1) {
    solve_1(b, a, false);
    return;
  }
  int ua = a.getTwo().first;
  int va = a.getTwo().second;
  int ub = b.getTwo().first;
  int vb = b.getTwo().second;
  a.erase(ua);
  a.erase(va);
  b.erase(ub);
  b.erase(vb);
  solve(a, b);
  if (bad(sol[a.p(ua)], ub) || bad(sol[a.p(va)], vb)) {
    sol[ua] = vb;
    sol[va] = ub;
  } else {
    sol[ua] = ub;
    sol[va] = vb;
  }
}
tree a, b;
int main() {
  int n;
  scanf("%d", &n);
  a.n = n;
  b.n = n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    a.g[u].insert(v);
    a.g[v].insert(u);
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    u -= n;
    v -= n;
    b.g[u].insert(v);
    b.g[v].insert(u);
    edges.insert({u, v});
  }
  a.init();
  b.init();
  if (a.kstar() == 0 || b.kstar() == 0) {
    printf("No\n");
    return 0;
  }
  printf("Yes\n");
  solve(a, b);
  for (int i = 0; i < n; i++) printf("%d ", sol[i] + 1 + n);
  printf("\n");
  return 0;
}