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>
const int N = 1e5 + 5, M = 1e5;
using namespace std;
long long myrand() {
  return ((long long)(rand() & 65535) << 32) + ((long long)rand() << 16) +
         rand();
}
pair<int, pair<long long, int> > st1[N], st2[N];
int vis[N], dis[N], off, pre[N], n, deg[N], deg2[N], u, v, ret[N];
vector<int> e[N], e2[N];
bitset<10100> adj[10100];
set<pair<int, pair<long long, int> > > hs;
pair<int, int> E[N];
void del(int u) {
  off += 1;
  dis[u] = 1;
  hs.erase(st1[u]);
  for (auto v : e[u])
    if (!dis[v]) {
      hs.erase(st1[v]);
      st1[v].first++;
      hs.insert(st1[v]);
    }
}
bool gao0() {
  for (int i = 1; i < n + 1; ++i) pre[i] = i;
  random_shuffle(pre + 1, pre + n + 1);
  for (int i = 1; i < n; ++i)
    if (adj[pre[E[i].first]][pre[E[i].second]]) return 0;
  for (int i = 1; i < n + 1; ++i) ret[pre[i]] = i;
  puts("Yes");
  for (int i = 1; i < n + 1; ++i) printf("%d ", ret[i] + n);
  puts("");
  return 1;
}
bool gao() {
  hs.clear();
  off = 0;
  for (int i = 1; i < n + 1; ++i) {
    st1[i] = make_pair(deg[i], make_pair(myrand(), i));
    st2[i] = make_pair(deg2[i], make_pair(myrand(), i));
    hs.insert(st1[i]);
    vis[i] = 0;
    dis[i] = 0;
  }
  for (int i = 1; i < n + 1; ++i) pre[i] = 0;
  pair<int, pair<long long, int> > val = st2[1];
  for (int i = 2; i < n + 1; ++i) val = min(val, st2[i]);
  priority_queue<pair<int, pair<long long, int> >,
                 vector<pair<int, pair<long long, int> > >,
                 greater<pair<int, pair<long long, int> > > >
      q;
  q.push(val);
  pre[val.second.second] = hs.begin()->second.second;
  vis[val.second.second] = 1;
  del(hs.begin()->second.second);
  while (!q.empty()) {
    pair<int, pair<long long, int> > st = q.top();
    q.pop();
    int u = st.second.second;
    int w = pre[u];
    for (auto v : e2[u])
      if (!vis[v]) {
        st2[v].first--;
        vis[v] = 1;
        vector<pair<int, pair<long long, int> > > tmp;
        while (1) {
          auto it =
              hs.lower_bound(make_pair(st2[v].first + off, make_pair(-1, -1)));
          if (it == hs.end()) return 0;
          if (adj[w][it->second.second]) {
            tmp.push_back(*it);
            hs.erase(it);
          } else {
            pre[v] = it->second.second;
            for (auto p : tmp) hs.insert(p);
            del(it->second.second);
            q.push(st2[v]);
            break;
          }
        }
      }
  }
  for (int i = 1; i < n + 1; ++i) ret[pre[i]] = i;
  puts("Yes");
  for (int i = 1; i < n + 1; ++i) printf("%d ", ret[i] + n);
  puts("");
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n + 1; ++i) deg[i] = n - 1;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v), e[v].push_back(u);
    adj[u][v] = adj[v][u] = 1;
    deg[u]--;
    deg[v]--;
  }
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    u -= n;
    v -= n;
    e2[u].push_back(v);
    e2[v].push_back(u);
    E[i] = make_pair(u, v);
    deg2[u]++;
    deg2[v]++;
  }
  for (int i = 1; i < n + 1; ++i)
    if (deg[i] == 0 || deg2[i] == n - 1) {
      puts("No");
      return 0;
    }
  while (1) {
    if (gao()) return 0;
    if (gao0()) return 0;
  }
  puts("No");
}