Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

F. Public Service

time limit per test

4 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThere 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 2*N*. 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* ≤ 2*N*), 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 *P*_{1}, *P*_{2}, ..., *P*_{N} (*N* + 1 ≤ *P*_{i} ≤ 2*N*) — the mapping between the two numbering schemes. More precisely, for *i* ≠ *j* it should be *P*_{i} ≠ *P*_{j}, and for every direct bus route (*i*, *j*), there is no direct train route between (*P*_{i}, *P*_{j}).

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):

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/12/2018 18:39:07 (d2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|