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;
const int N = 10005;
int n;
struct Tree {
  set<pair<int, int>> e;
  set<int> l[N];
  int deg[N];
  set<int> c;
  set<pair<int, int>> q, lf;
  inline void add_edge(int u, int v) {
    e.insert({u, v});
    e.insert({v, u});
    l[u].insert(v);
    l[v].insert(u);
    ++deg[u];
    ++deg[v];
  }
  void init() {
    for (int i = 1; i <= n; i++) {
      c.insert(i), q.insert({deg[i], i});
      if (deg[i] == 1) lf.insert({*l[i].begin(), i});
    }
  }
  inline int chk() { return int(c.size() - q.rbegin()->first - 1); }
  int push(int p[], int u, int v, int w) {
    int idx = 0;
    for (auto &i : c)
      if (u != i && v != i && w != i) p[++idx] = i;
    return idx;
  }
  pair<int, int> s[5];
  pair<int, int> get_leaf() {
    s[1] = *lf.begin(), s[2] = *++lf.begin(), s[3] = *lf.rbegin(),
    s[4] = *++lf.rbegin();
    sort(s + 1, s + 5);
    int mx = -1;
    for (int i = 1; i < 5; i++)
      if (deg[s[i].first] > 2) {
        mx = s[i].first;
        break;
      }
    if (mx == -1) return {lf.begin()->second, lf.rbegin()->second};
    int u = -1, v = -1;
    for (int i = 1; i < 5; i++)
      if (s[i].first == mx)
        u = s[i].second;
      else
        v = s[i].second;
    return {u, v};
  }
  void erase(int id) {
    int x = *l[id].begin();
    c.erase(id);
    lf.erase({x, id});
    q.erase({1, id});
    l[id].erase(x);
    l[x].erase(id);
    q.erase({deg[x]--, x});
    q.insert({deg[x], x});
    if (deg[x] == 1) lf.insert({*l[x].begin(), x});
  }
} a, b;
int g[N], h[N], ans[N];
bool chk(int cur) {
  for (int i = 1; i <= cur; i++)
    for (int j = 1; j < i; j++)
      if (a.e.count({g[i], g[j]}) && b.e.count({h[i], h[j]})) return 0;
  return 1;
}
void solve1() {
  int cur = a.push(g, 0, 0, 0);
  b.push(h, 0, 0, 0);
  do
    if (chk(cur)) {
      for (int i = 1; i <= cur; i++) ans[g[i]] = h[i];
      return;
    }
  while (next_permutation(g + 1, g + cur + 1));
}
void solve2(Tree &a, Tree &b) {
  int u = (++a.q.rbegin())->second, v = *a.l[u].begin(), w = *a.l[u].rbegin();
  if (a.deg[w] == 1) swap(v, w);
  int uu = -1, vv = b.lf.begin()->first, ww = b.lf.begin()->second;
  for (auto &i : b.c)
    if (!b.e.count({i, vv}) && !b.e.count({i, ww})) {
      uu = i;
      break;
    }
  ans[u] = uu;
  ans[v] = vv;
  ans[w] = ww;
  int cur = a.push(g, u, v, w);
  b.push(h, uu, vv, ww);
  for (int i = 1; i <= cur; i++) ans[g[i]] = h[i];
}
int tmp[N];
void re() {
  for (int i = 1; i <= n; i++) tmp[ans[i]] = i;
  for (int i = 1; i <= n; i++) ans[i] = tmp[i];
}
void solve() {
  if (a.c.size() < 4 || !a.chk() || !b.chk()) {
    puts("No");
    exit(0);
  }
  if (a.c.size() < 6) return solve1();
  if (a.chk() == 1) return solve2(a, b);
  if (b.chk() == 1) {
    solve2(b, a);
    return re();
  }
  pair<int, int> aa = a.get_leaf(), cc = b.get_leaf(),
                 bb = {*a.l[aa.first].begin(), *a.l[aa.second].begin()},
                 dd = {*b.l[cc.first].begin(), *b.l[cc.second].begin()};
  a.erase(aa.first);
  a.erase(aa.second);
  b.erase(cc.first);
  b.erase(cc.second);
  solve();
  if (ans[bb.first] != dd.first && ans[bb.second] != dd.second)
    ans[aa.first] = cc.first, ans[aa.second] = cc.second;
  else
    ans[aa.first] = cc.second, ans[aa.second] = cc.first;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    a.add_edge(t1, t2);
  }
  for (int i = 1; i < n; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    b.add_edge(t1 - n, t2 - n);
  }
  a.init();
  b.init();
  solve();
  cout << "Yes" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] + n << ' ';
  return 0;
}