In Fall Guys squads show, squads of 4 to compete against other teams. The show starts with 15 squads (60 players). In each round some squad(s) will be eliminated until one single squad remains which will be declared as the winner.
Now, your squad is competing in one of the rounds - Slime Climb. In Slime Climb, individual players race to the finish line as quick as possible while avoiding falling into the rising slime. Players who finish the race will score $$$(\text{number of players}) - (\text{individual rank}) + 1$$$ points. For example, when there are 60 players, the first player to reach the finish line will gain 60 points for their squad. The 2nd player will gain 59 points, etc. Other players who fall into the slime will score 0 points. Because the slime rises continuously, players who are slow will eventually fall into the slime. The total score of a squad is the sum of individual scores of the 4 members.
[video]fallguys_cut_2.mp4[/video]
There are $$$N$$$ squads ($$$4N$$$ players) including your squad. The squads are numbered from $$$1$$$ to $$$N$$$. There is a target number of qualifying teams $$$M$$$. Normally, if the squads at the $$$M^{th}$$$ and $$$(M + 1)^{th}$$$ positions have different scores, the top $$$M$$$ squads with the highest total score will qualify and the rest will be eliminated. If the squads at the $$$M^{th}$$$ and $$$(M + 1)^{th}$$$ positions have the same score, squads that tie for the $$$M^{th}$$$ position will all be eliminated. However, when top $$$M + 1$$$ squads all have the same score, the other squads that score less will be eliminated instead.
In the middle of the race, $$$F$$$ players have reached the finish line. The $$$i$$$-th player to reach the finish line is from squad $$$A_i$$$. Also, $$$S$$$ players fell into the slime. Their squad numbers are $$$B_1, B_2, \dots, B_S$$$.
You would like to know if the set of qualifying teams have been determined already, regardless of the outcome (order of finishing the race or whether they fall into the slime) of the remaining players. To save time, the game can end the round early if the set has been determined.
The first line contains 2 integer $$$N$$$ and $$$M$$$. ($$$1 \le M \lt N \le 15$$$)
The second line begins with a non-negative integer $$$F$$$, followed by $$$F$$$ integers $$$A_1, A_2, \dots, A_F$$$.
The third line begins with a non-negative integer $$$S$$$, followed by $$$S$$$ integers $$$B_1, B_2, \dots, B_S$$$.
$$$0 \le F + S \lt 4N$$$. It is guaranteed that a squad will not appear more than 4 times in the lists.
Output Yes if the set of qualifying teams has been determined regardless of the outcome of the remaining players. Output No otherwise.
2 1 6 1 1 1 2 2 2 0
Yes
3 2 9 1 2 3 2 3 1 3 1 2 2 1 2
No
In the first example, 3 players from the squad 1 already gained $$$8 + 7 + 6 = 21$$$ points and 3 players from squad 2 gained $$$5 + 4 + 3 = 12$$$ points. There is no way for squad 2 to gain more points to tie/surpass squad 1 and therefore the set of qualifying squads has been determined. Only squad 1 will qualify.
In the second example, all squads currently have 24 points. Only 1 player from squad 3 remains. If the player finishes the race, squad 3 will have 26 points and qualify. Squad 1 and 2 will be eliminated because they tie for the 2nd position. If the player fall into the slime, all teams will qualify because they have the same score.
Additional Notes:
| Name |
|---|


