Time limit: 0.1s
Memory limit: 32MB
You are attending a table tennis tournament and you decided to note down the results the players achieved.
However, a bad misfortune happened and you lost your detailed list of results so you don't know the way the games went anymore.
There is good news though: In order to avoid a complete loss of data, you also noted how many points each player has scored in total during all the sets they played.
In addition, you also know that the first player always won in the end.
Now your goal is to reconstruct the way games turned out, if you know the following details:
- The games have been played using normal table tennis rules, but with a key difference. The set always ends when a player reaches points (even when the score is , so no tiebreaks exist).
- The match is played using a best of system (the first player to win sets wins the game).
- The first player always won in the end.
Since the games can turn out in many different ways, any such sequence of set scores is acceptable.
The first line of the input will contain , the number of test cases.
Each test case will contain two integers, and , representing the number of points each player obtained during the game.
For each test case, you will either print a way the game could have turned out, with each set written on one line, or if no such way exists.
Constraints and clarifications
- For tests worth points, the match can be won by the first player in sets.
- For tests worth more points, the match can be won by the first player in sets.
5 33 15 40 29 55 55 39 16 29 54
11 10 11 5 11 0 7 11 11 10 11 8 11 0 -1 -1 6 11 11 5 11 0 11 0 -1 -1
In the first sample case, the first player can win in sets, with results , and .
Note that in this case, there are multiple ways in which the first player could have won the game.
In the last sample case, the total points won by the first player is .
It can be seen that there is no way in which they could have won sets (and, therefore, the game) with points total.