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 MaxN = 10005;
int n;
struct tree_t {
  set<int> e[MaxN], pe[MaxN], vs;
  set<pair<int, int> > ds, lv;
  int d[MaxN];
  void add(int u, int v) {
    e[u].insert(v);
    e[v].insert(u);
    pe[u].insert(v);
    pe[v].insert(u);
    ++d[u];
    ++d[v];
  }
  int fe(int x) { return *e[x].begin(); }
  void prep() {
    for (int i = 1; i <= n; i++) {
      vs.insert(i);
      ds.insert(make_pair(d[i], i));
      if (d[i] == 1) lv.insert(make_pair(fe(i), i));
    }
  }
  int ojbk() {
    int mx = ds.rbegin()->first;
    return (int)vs.size() - mx - 1;
  }
  pair<int, int> find() {
    vector<pair<int, int> > ps;
    int nd = 2;
    auto it = lv.begin();
    while (nd--) ps.push_back(*it), it++;
    nd = 2;
    auto ti = lv.rbegin();
    while (nd--) ps.push_back(*ti), ti++;
    int u = -1;
    for (auto i : ps) {
      int j = i.first;
      if (d[j] > 2) {
        u = j;
        break;
      }
    }
    if (~u) {
      int a, b;
      a = b = -1;
      for (auto x : ps) {
        int y = x.first;
        if (y == u)
          a = x.second;
        else
          b = x.second;
      }
      assert(~a && ~b);
      assert((*e[a].begin()) != (*e[b].begin()));
      return make_pair(a, b);
    } else {
      assert(ps.size() > 1);
      int a = ps[0].second, b = ps[2].second;
      return make_pair(a, b);
    }
  }
  void de(int x) {
    vs.erase(x);
    int y = fe(x);
    lv.erase(make_pair(y, x));
    ds.erase(make_pair(1, x));
    e[x].erase(y);
    e[y].erase(x);
    ds.erase(make_pair(d[y]--, y));
    ds.insert(make_pair(d[y], y));
    if (d[y] == 1) lv.insert(make_pair(fe(y), y));
  }
} A, B;
int ans[MaxN], rev[MaxN];
void solve0(int n) {
  vector<int> vx, vy;
  for (auto x : A.vs) vx.push_back(x);
  for (auto y : B.vs) vy.push_back(y);
  do {
    int ok = true;
    for (int i = 0; i < n && ok; i++)
      for (int j = 0; j < i; j++) {
        bool cx = A.e[vx[i]].find(vx[j]) != A.e[vx[i]].end();
        bool cy = B.e[vy[i]].find(vy[j]) != B.e[vy[i]].end();
        if (cx && cy) ok = false;
      }
    if (ok) {
      for (int i = 0; i < n; i++) ans[vx[i]] = vy[i];
      return;
    }
  } while (next_permutation(vx.begin(), vx.end()));
}
void solve1(tree_t &A, tree_t &B) {
  int u = (++A.ds.rbegin())->second;
  int v = 0, w = 0;
  for (auto t : A.e[u])
    if (A.e[t].size() == 1)
      v = t;
    else
      w = t;
  int w_ = B.lv.begin()->second;
  int v_ = *B.e[w_].begin();
  int u_ = 0;
  for (auto p : B.vs) {
    bool cx = B.e[p].find(v_) != B.e[p].end();
    bool cy = B.e[p].find(w_) != B.e[p].end();
    if (!cx && !cy) {
      u_ = p;
      break;
    }
  }
  ans[u] = u_;
  ans[v] = v_;
  ans[w] = w_;
  vector<int> tt;
  for (auto x : B.vs)
    if (x != u_ && x != v_ && x != w_) tt.push_back(x);
  int t_ = 0;
  for (auto x : A.vs)
    if (x != u && x != v && x != w) ans[x] = tt[t_++];
}
void work() {
  int cur_n = A.vs.size();
  if (cur_n <= 5) {
    solve0(cur_n);
    return;
  }
  if (A.ojbk() == 1) {
    solve1(A, B);
    return;
  }
  if (B.ojbk() == 1) {
    solve1(B, A);
    for (int i = 1; i <= n; i++) rev[ans[i]] = i;
    for (int i = 1; i <= n; i++) ans[i] = rev[i];
    return;
  }
  int a, b, c, d;
  tie(a, b) = A.find();
  tie(c, d) = B.find();
  int e = A.fe(a), f = A.fe(b), g = B.fe(c), h = B.fe(d);
  A.de(a);
  A.de(b);
  B.de(c);
  B.de(d);
  work();
  ans[a] = d, ans[b] = c;
  if (ans[e] != g && ans[f] != h) swap(ans[a], ans[b]);
}
bool validate() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < i; j++) {
      bool cx = A.pe[i].find(j) != A.pe[i].end();
      bool cy = B.pe[ans[i]].find(ans[j]) != B.pe[ans[i]].end();
      if (cx && cy) {
        return false;
      }
    }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    A.add(u, v);
  }
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    u -= n;
    v -= n;
    B.add(u, v);
  }
  A.prep();
  B.prep();
  if (!A.ojbk() || !B.ojbk()) {
    puts("No");
    return 0;
  }
  work();
  puts("Yes");
  for (int i = 1; i <= n; i++) printf("%d ", ans[i] + n);
  puts("");
  return 0;
}