题目描述
Problem Description
This game is designed for exactly 4 players, and in each round, players earn points according to their ranks from 1st to 3rd. There are no ties in the match results. On the score display screen, you can see the history of points accumulated by each player.
For example, if a player's record shows "1 2 2", it indicates that the player achieved 1st place in some round, then 2nd place in another round, and again 2nd place in yet another round, after which the player did not earn any more points.
My friend Iroha and I played a match consisting of $N$ rounds. The score data for each of the 4 players over these $N$ rounds is given as input. Your task is to determine if the game results are possible and, if they are, to output an example of the match results for each round.
Input Format
The input consists of 5 lines.
The first line contains the number of rounds $N$, the number of times player 1 earned points $A$, the number of times player 2 earned points $B$, the number of times player 3 earned points $C$, and the number of times player 4 earned points $D$.
The second line contains $A$ integers representing the ranks player 1 achieved in the rounds they earned points.
Lines 3 to 5 contain the score information for players 2 to 4, respectively, in the same format as the second line.
Refer to the following:
$N$ $A$ $B$ $C$ $D$ $a_1$ $a_2$ $\cdots$ $a_A$ $b_1$ $b_2$ $\cdots$ $b_B$ $c_1$ $c_2$ $\cdots$ $c_C$ $d_1$ $d_2$ $\cdots$ $d_D$
Output Format
If there is no possible match result that satisfies the input, output No.
If there is a possible match result, output Yes followed by $N$ lines, each containing the player number who got the 4th place in each round. If multiple outputs satisfy the input, any one of them is acceptable.
Sample Input and Output
Sample Input #1
1 1 1 1 0
1
3
2
Sample Output #1
Yes
4
Sample Input #2
1 0 0 0 0
Sample Output #2
No
Sample Input #3
10 8 7 8 7
1 3 1 3 1 3 1 2
3 3 1 2 3 3 3
2 2 2 1 1 2 2 1
1 2 3 2 2 1 3
Sample Output #3
Yes
4
2
4
3
3
2
1
4
1
2
Notes/Hints
Story
It all began one night. At that time, my friend Iroha and I were obsessed with a game of stacking colorful blocks. The game was nothing special, but it had numerous bugs, such as blocks that should have disappeared but didn't, blocks flying away due to wind, and strange floating islands appearing.
That night, Iroha and I were playing this game online, but the match results seemed odd. "Maybe there's a bug in the scoring system?" Iroha suggested, and I decided to verify if that was true.
Constraints
- All inputs are integers.
- $0 \leq A, B, C, D \leq 100$
- $1 \leq N \leq 100$
- $1 \leq a_i \leq 3$ $(1 \leq i \leq A)$
- $1 \leq b_i \leq 3$ $(1 \leq i \leq B)$
- $1 \leq c_i \leq 3$ $(1 \leq i \leq C)$
- $1 \leq d_i \leq 3$ $(1 \leq i \leq D)$
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分