Billiards is a sport where players use a cue to strike the white cue ball and pot other balls into pockets. One famous variant is Snooker. With Zhao Xintong winning the Snooker World Championship, this sport has gained more attention in China. The rules of Snooker are quite complex, and this problem focuses primarily on the scoring rules. Note that the Snooker rules described here may differ from actual Snooker rules, so please follow the description here.
First, let's familiarize ourselves with the $$$21$$$ balls in Snooker. Red balls: Each worth $$$1$$$ point, with $$$15$$$ balls in total. Colored balls: yellow ($$$2$$$ points), green ($$$3$$$ points), brown ($$$4$$$ points), blue ($$$5$$$ points), pink ($$$6$$$ points), black ($$$7$$$ points), with only one ball of each color.
We refer to the two players in a frame of Snooker as Player A and Player B. Both start with a score of $$$0$$$. Player A takes the first turn, and the process begins as follows:
For convenience, this problem does not consider any fouls or special situations, including but not limited to potting multiple balls simultaneously or potting non-target balls. Only the scenarios mentioned above need to be considered.
Due to overtime work, Panda missed the beginning of a Snooker frame. When he returns home and turns on the TV, he sees that a player is currently at the table. At this moment, there are $$$n$$$ balls (red and colored) on the table, where any balls that should be returned to the table have been put back, and the current scores of Players A and B are $$$a:b$$$. Panda wants to deduce what might have happened earlier based on the current situation. Specifically, output any sequence of successful and failed shots (encoded as output format described below) that could lead from the start of the frame to the given current state, or determine that no such sequence exists. If multiple solutions exist, output any one of them.
The first line contains an integer $$$T$$$ ($$$1 \le T \le 2000$$$), indicating the number of test cases.
Each of the next $$$T$$$ lines contains four integers $$$a, b, n, p$$$ ($$$0 \le a, b \le 200$$$, $$$0 \le n \le 21$$$, $$$0 \le p \le 1$$$), representing the current scores of Player A and Player B as $$$a:b$$$, and the total number of red and colored balls currently on the table is $$$n$$$. If $$$p = 0$$$, Player A is currently at the table; if $$$p = 1$$$, Player B is currently at the table.
For each test case, output a string representing the sequence of steps, where digits $$$\texttt{1}$$$ to $$$\texttt{7}$$$ indicate that the current player potted a ball of the corresponding points, and the character $$$\texttt{/}$$$ indicates that the player failed to pot a ball, resulting in a switch to the opponent. If no valid sequence exists, output $$$\texttt{NA}$$$ in a single line. If multiple solutions exist, output any one of them. The length of the output string for each test case should not exceed $$$100$$$. Do not output extra spaces.
78 110 1 1147 0 0 00 0 21 01 0 20 01 1 19 10 0 0 0147 0 0 1
/16121516/17/1717171717171217121423456 171717171717171717171717171717234567 //1// /1/1/ NA NA
The first test case in the example is the final frame where Zhao Xintong won the Snooker World Championship (Player A is Mark Williams, Player B is Zhao Xintong).