题目描述
Problem Description
$ 2^N $ players participated in a tournament. Each player is assigned a number from $ 1 $ to $ 2^N $, and when two players compete, the player with the smaller number always wins.
The tournament is a bit unusual in that losers also compete against each other to determine the rankings of all players.
We call such a tournament with $ 2^n $ players a "level $ n $ full tournament". The rankings in a level $ n $ full tournament are determined as follows:
- In a level $ 0 $ full tournament, there is only one participant, who ranks first.
- In a level $n\ (1\ \leq\ n)$ full tournament, $ 2^n $ players start in a single row and the rankings are determined as follows:
- First, divide the players into $ 2^{n-1} $ pairs from the ends.
- Each pair competes, and the winner goes to the winning group, while the loser goes to the losing group.
- The players in the winning group maintain their original order and participate in a level $ n-1 $ full tournament to determine their rankings.
- Similarly, the losing group determines their rankings, and then each player in the losing group adds $ 2^{n-1} $ to their rank.
For example, if 8 players are arranged in the order $ 3,4,8,6,2,1,7,5 $ and participate in a level $ 3 $ full tournament, the tournament proceeds as shown in the figure below, and the players arranged in the order of their final rankings are $ 1,3,5,6,2,4,7,8 $.

Takahashi had a sheet of paper listing the player numbers in the order of their tournament results, but some parts were smudged and unreadable. The information on this sheet is given as a sequence $ A $ of length $ N $, where $ A_i $ indicates that the player ranked $ i $ had the number $ A_i $ if $ A_i $ is greater than $ 1 $, or that the number of the player ranked $ i $ is unknown if $ A_i $ is $ 0 $.
Determine if there exists an initial arrangement of players that could lead to the given rankings, and if so, provide one such arrangement.
Input Format
The input is given from the standard input in the following format:
$ N $ $ A_1 $ $ A_2 $ $ ... $ $ A_{2^N} $
Output Format
If there exists an initial arrangement of players that could lead to the given rankings, output YES and on the second line, output the player numbers in order separated by spaces. If no such arrangement exists, output NO instead.
Sample Input and Output
Sample Input #1
3
0 3 0 6 0 0 0 8
Sample Output #1
YES
3 4 8 6 2 1 7 5
Sample Input #2
1
2 1
Sample Output #2
NO
Notes/Hints
Constraints
- $1\ \leq\ N\ \leq\ 18$
- $0\ \leq\ A_i\ \leq\ 2^N$
- The integers in $ A_i $ other than $ 0 $ are distinct.
Sample Explanation 1
This is the same arrangement as in the example in the problem statement.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分