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;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 30010;
const int INF = 1e9;
int N;
struct data {
  int d, fa, x;
  data(int dd = 0, int ff = 0, int xx = 0) {
    d = dd;
    fa = ff;
    x = xx;
  }
  inline void print() {
    cout << "deg:" << d << " fa:" << fa << " x:" << x << endl;
  }
  bool operator<(const data &a) const {
    return ((a.d != d) ? a.d > d : (a.fa != fa) ? a.fa > fa : a.x > x);
  }
};
struct Tree {
  int Node[MAXN << 1], Next[MAXN << 1], Root[MAXN + 1], cnt;
  int lft;
  bool vis[MAXN + 1];
  int deg[MAXN + 1];
  map<int, bool> Edge[MAXN + 1];
  inline void insert(int u, int v) {
    Node[++cnt] = v;
    Next[cnt] = Root[u];
    Root[u] = cnt;
    deg[v]++;
    Edge[u][v] = Edge[v][u] = 1;
    return;
  }
  set<data> S, Leaf;
  inline data GetLeaf(int last) {
    data q = data(1, last, 0);
    return *Leaf.lower_bound(q);
  }
  inline data GetLeaf2(int last, int last2) {
    data q = data(1, last, last2);
    return *Leaf.lower_bound(q);
  }
  data inf[MAXN + 1];
  inline void Upd(int x, data v) {
    if (v.d == 1) {
      for (int x = Root[v.x]; x; x = Next[x]) {
        int vt = Node[x];
        if (!vis[vt]) {
          v.fa = vt;
          break;
        }
      }
    }
    S.erase(S.find(inf[x]));
    inf[x] = v;
    S.insert(v);
    if (v.d == 1) Leaf.insert(v);
    return;
  }
  inline void Erase(int u) {
    if (Leaf.find(inf[u]) != Leaf.end()) Leaf.erase(Leaf.find(inf[u]));
    S.erase(S.find(inf[u]));
    int fa = inf[u].fa;
    vis[u] = 1;
    if (!vis[fa]) Upd(fa, data(inf[fa].d - 1, inf[fa].fa, inf[fa].x));
    --lft;
    return;
  }
  inline void dfs(int k, int Fa) {
    for (int x = Root[k]; x; x = Next[x]) {
      int v = Node[x];
      if (v == Fa) continue;
      if (!Fa) Fa = v;
      dfs(v, k);
    }
    S.insert(inf[k] = data(deg[k], Fa, k));
    if (deg[k] == 1) Leaf.insert(inf[k]);
  }
  inline void print() {
    cout << "Tree:\n";
    for (auto v : S) {
      cout << "deg:" << v.d << " fa:" << v.fa << " x:" << v.x << endl;
    }
  }
  inline void print3() {
    cout << "Leaf:\n";
    for (auto v : Leaf) {
      cout << "deg:" << v.d << " fa:" << v.fa << " x:" << v.x << endl;
    }
  }
  inline void build() {
    dfs(1, 0);
    lft = N;
  }
  inline bool Star() {
    set<data>::iterator it = S.end();
    --it;
    if ((*it).d == S.size() - 1) return 1;
    return 0;
  }
  inline bool Star2() {
    set<data>::iterator it = S.end();
    --it;
    if ((*it).d != S.size() - 2) return 0;
    --it;
    if ((*it).d != 2) return 0;
    return 1;
  }
  inline data Mxdeg() { return (*S.rbegin()); }
  inline int dfs_find(int k, int Fa, int d) {
    if (!d) return k;
    for (int x = Root[k]; x; x = Next[x]) {
      int v = Node[x];
      if (vis[v] || v == Fa) continue;
      int ret = dfs_find(v, k, d - 1);
      if (ret) return ret;
    }
    return 0;
  }
  inline void dfsprint(int k, int Fa) {
    for (int x = Root[k]; x; x = Next[x]) {
      int v = Node[x];
      if (v == Fa) continue;
      if (!vis[v] && !vis[k]) cout << k << " " << v << endl;
      dfsprint(v, k);
    }
  }
  inline void print2() { dfsprint(1, 0); }
} T1, T2, T3;
int a[55];
int sz = 0;
bool vis[MAXN + 1];
vector<int> vec1, vec2;
inline void Initvec() {
  vec1.clear();
  vec2.clear();
  for (int i = 1; i <= N; i++)
    if (!T1.vis[i]) vec1.push_back(i);
  for (int i = 1; i <= N; i++)
    if (!T2.vis[i]) vec2.push_back(i);
}
int Tns[MAXN + 1];
inline void solvestar() {
  data u1 = T1.GetLeaf(0), lastu = u1;
  while (u1.fa == T1.Mxdeg().x) {
    u1 = T1.GetLeaf2(u1.fa, u1.x + 1);
    if (u1.x == lastu.x) ++u1.fa, u1.x = 0;
    lastu = u1;
  }
  T1.Erase(u1.x);
  data v1 = T1.inf[u1.fa];
  T1.Erase(v1.x);
  data w1 = T1.inf[v1.fa];
  swap(u1, v1);
  data w2 = T2.GetLeaf(0);
  T2.Erase(w2.x);
  data v2 = T2.inf[w2.fa];
  data u2 = T2.inf[T2.dfs_find(v2.x, 0, 2)];
  Tns[u2.x] = u1.x;
  Tns[v2.x] = v1.x;
  Tns[w2.x] = w1.x;
  T1.vis[u1.x] = 1;
  T1.vis[v1.x] = 1;
  T1.vis[w1.x] = 1;
  T2.vis[u2.x] = 1;
  T2.vis[v2.x] = 1;
  T2.vis[w2.x] = 1;
  Initvec();
  for (int i = 0, sz = vec2.size(); i < sz; i++) Tns[vec2[i]] = vec1[i];
  return;
}
inline bool dfs(int k) {
  if (k == sz + 1) {
    for (int t = 0; t < vec2.size(); t++) {
      for (int j = t + 1; j < vec2.size(); j++) {
        int v1 = vec2[t], v2 = vec2[j];
        if (T2.Edge[v1][v2] && T1.Edge[vec1[a[t]]][vec1[a[j]]]) {
          return 0;
        }
      }
    }
    for (int i = 0; i < vec2.size(); i++) Tns[vec2[i]] = vec1[a[i]];
    return 1;
  }
  for (int i = 1; i <= sz; i++) {
    if (!vis[i]) {
      vis[i] = 1;
      a[k - 1] = i - 1;
      if (dfs(k + 1)) return 1;
      vis[i] = 0;
    }
  }
  return 0;
}
inline void solveforce() {
  Initvec();
  sz = vec2.size();
  for (int i = 1; i <= sz; i++) vis[i] = 0;
  dfs(1);
  return;
}
int Tns2[MAXN + 1];
inline bool solve() {
  if (T1.Star() || T2.Star()) return 0;
  if (T1.lft <= 5) {
    solveforce();
    return 1;
  }
  bool rev = 0;
  if (T2.Star2()) rev = 1, T3 = T2, T2 = T1, T1 = T3;
  if (T1.Star2()) {
    solvestar();
    if (rev) {
      for (int i = 1; i <= N; i++) Tns2[Tns[i]] = i;
      for (int i = 1; i <= N; i++) Tns[i] = Tns2[i];
    }
    return 1;
  }
  data F[2][2];
  F[0][0] = T1.GetLeaf(0);
  F[0][1] = T1.GetLeaf(F[0][0].fa + 1);
  if (T1.Mxdeg().d == T1.S.size() - 3 && F[0][0].fa != T1.Mxdeg().x &&
      F[0][1].fa != T1.Mxdeg().x) {
    F[0][1] = T1.GetLeaf2(F[0][1].fa, F[0][1].x + 1);
  }
  T1.Erase(F[0][1].x);
  T1.Erase(F[0][0].x);
  F[1][0] = T2.GetLeaf(0);
  F[1][1] = T2.GetLeaf(F[1][0].fa + 1);
  if (T2.Mxdeg().d == T2.S.size() - 3 && F[1][0].fa != T2.Mxdeg().x &&
      F[1][1].fa != T2.Mxdeg().x) {
    F[1][1] = T2.GetLeaf2(F[1][1].fa + 1, F[1][1].x + 1);
  }
  T2.Erase(F[1][1].x);
  T2.Erase(F[1][0].x);
  if (!solve()) return 0;
  if (Tns[F[1][0].fa] == F[0][0].fa || Tns[F[1][1].fa] == F[0][1].fa) {
    Tns[F[1][0].x] = F[0][1].x;
    Tns[F[1][1].x] = F[0][0].x;
  } else {
    Tns[F[1][0].x] = F[0][0].x;
    Tns[F[1][1].x] = F[0][1].x;
  }
  return 1;
}
int main() {
  N = read();
  for (int i = 1; i < N; i++) {
    int u = read(), v = read();
    T1.insert(u, v);
    T1.insert(v, u);
  }
  for (int i = 1; i < N; i++) {
    int u = read() - N, v = read() - N;
    T2.insert(u, v);
    T2.insert(v, u);
  }
  T1.build();
  T2.build();
  if (!solve())
    puts("No");
  else {
    puts("Yes");
    for (int i = 1; i <= N; i++) Tns2[Tns[i]] = i;
    for (int i = 1; i <= N; i++) printf("%d ", Tns2[i] + N);
    printf("\n");
  }
  return 0;
}