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;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) {
  long long z = y;
  while (x % y != 0) {
    z = x % y;
    x = y;
    y = z;
  }
  return z;
}
int N;
struct gt {
  set<int> mp[100005], lf2, tof[100005], nodes;
  set<pair<int, int> > sp;
  int d[100005];
  void rd() {
    for (int(i) = 0; (i) < (int)(n - 1); (i)++) {
      int u, v;
      scanf("%d%d", &u, &v);
      if (u > n) {
        u -= n;
        v -= n;
      }
      d[u]++;
      d[v]++;
      mp[u].insert(v);
      mp[v].insert(u);
    }
    for (int(i) = 1; (i) <= (int)(n); (i)++) sp.insert({d[i], i});
    for (int(i) = 1; (i) <= (int)(n); (i)++) {
      if (d[i] == 1) {
        for (int gg : mp[i]) {
          lf2.insert(gg);
          tof[gg].insert(i);
        }
      }
      nodes.insert(i);
    }
  }
  bool isStar() { return sp.rbegin()->first == N - 1; }
  bool is1Star() { return sp.rbegin()->first == N - 2; }
  void rm(int x) {
    nodes.erase(x);
    assert(d[x] == 1);
    int F = *mp[x].begin();
    tof[F].erase(x);
    if (tof[F].empty()) {
      lf2.erase(F);
    }
    sp.erase({d[x], 1});
    sp.erase({d[F], F});
    d[F]--;
    sp.insert({d[F], F});
    d[x] = 0;
    mp[F].erase(x);
    mp[x].erase(F);
    if (d[F] == 1) {
      assert(mp[F].size() == 1);
      int zz = *mp[F].begin();
      tof[zz].insert(F);
      lf2.insert(zz);
    }
  }
  void getPair(int &tu, int &u, int &tv, int &v) {
    int C = sp.rbegin()->second;
    if (d[C] == N - 3) {
      assert(lf2.count(C));
      tu = C;
      u = *tof[C].begin();
      for (int z : lf2)
        if (z != C) {
          tv = z;
          v = *tof[tv].begin();
        }
      return;
    }
    tu = *lf2.begin();
    u = *tof[tu].begin();
    tv = *lf2.rbegin();
    v = *tof[tv].begin();
  }
} T[2];
int ans[100005];
void ppt() {
  for (int(i) = 1; (i) <= (int)(n); (i)++) printf("%d ", ans[i] + n);
  exit(0);
}
void abri() {
  vector<int> A, B, C;
  for (int nd : T[0].nodes) A.push_back(nd);
  for (int nd : T[1].nodes) B.push_back(nd);
  C.resize(N);
  for (int(i) = 0; (i) < (int)(N); (i)++) C[i] = i;
  do {
    map<int, int> tmp;
    for (int(i) = 0; (i) < (int)(N); (i)++) tmp[A[i]] = B[C[i]];
    bool ok = 1;
    for (int x : A) {
      for (int y : T[0].mp[x]) {
        int X = tmp[x], Y = tmp[y];
        if (T[1].mp[X].count(Y)) {
          ok = 0;
          break;
        }
      }
      if (ok == 0) break;
    }
    if (ok) {
      for (int(i) = 0; (i) < (int)(N); (i)++) ans[A[i]] = B[C[i]];
      break;
    }
  } while (next_permutation(C.begin(), C.end()));
}
void mt(int x, int y, bool rev) {
  if (rev)
    ans[x] = y;
  else
    ans[y] = x;
}
void cal() {
  if (N <= 5) {
    abri();
    return;
  }
  if (T[0].is1Star() || T[1].is1Star()) {
    bool first = T[0].is1Star();
    if (!first) swap(T[0], T[1]);
    int w = T[0].sp.rbegin()->second;
    int u, v;
    for (int zz : T[0].lf2)
      if (zz != w) {
        u = zz;
        for (int zzz : T[0].mp[u])
          if (zzz != w) {
            v = zzz;
            break;
          }
        break;
      }
    int v1 = *T[1].lf2.begin();
    int w1, u1;
    for (int z : T[1].mp[v1])
      if (T[1].d[z] == 1) {
        w1 = z;
        break;
      }
    for (int nd : T[1].nodes)
      if (T[1].mp[nd].count(w1) == 0 && T[1].mp[nd].count(v1) == 0) {
        u1 = nd;
        break;
      }
    mt(w, w1, first);
    mt(u, u1, first);
    mt(v, v1, first);
    vector<int> A, B;
    for (int nd : T[0].nodes)
      if (nd != w && nd != u && nd != v) {
        A.push_back(nd);
      }
    for (int nd : T[1].nodes)
      if (nd != w1 && nd != u1 && nd != v1) {
        B.push_back(nd);
      }
    for (int(i) = 0; (i) < (int)(A.size()); (i)++) mt(A[i], B[i], first);
    if (!first) swap(T[0], T[1]);
    return;
  }
  int tu, u, tv, v;
  T[0].getPair(tu, u, tv, v);
  int tu1, u1, tv1, v1;
  T[1].getPair(tu1, u1, tv1, v1);
  T[0].rm(u);
  T[0].rm(v);
  T[1].rm(u1);
  T[1].rm(v1);
  N -= 2;
  cal();
  if (ans[tu] != tu1 && ans[tv] != tv1) {
    mt(u, u1, 1);
    mt(v, v1, 1);
  } else {
    mt(u, v1, 1);
    mt(v, u1, 1);
  }
}
void fmain(int ID) {
  scanf("%d", &n);
  for (int(i) = 0; (i) < (int)(2); (i)++) T[i].rd();
  N = n;
  for (int(i) = 0; (i) < (int)(2); (i)++)
    if (T[i].isStar()) etp();
  puts("Yes");
  cal();
  ppt();
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}