Mirror IIOT 2023-2024 Round I | Ping Pong

This was the problem page during the contest. Access the current page here.
Time limit: 0.1s Memory limit: 32MB Input: Output:

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 TT 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 1111 points (even when the score is 111011-10, so no tiebreaks exist).
  • The match is played using a best of 55 system (the first player to win 33 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.

Input data

The first line of the input will contain TT, the number of test cases.

Each test case will contain two integers, AA and BB, representing the number of points each player obtained during the game.

Output data

For each test case, you will either print a way the game could have turned out, with each set written on one line, or 1 1-1 \ -1 if no such way exists.

Constraints and clarifications

  • 1T3 0001 \leq T \leq 3 \ 000;
  • 1A,B601 \leq A, B \leq 60
  • For tests worth 2020 points, the match can be won by the first player in 33 sets.
  • For tests worth 3030 more points, the match can be won by the first player in 44 sets.

Example 1

stdin

5
33 15
40 29
55 55
39 16
29 54

stdout

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

Explanation

In the first sample case, the first player can win in 33 sets, with results 111011 - 10, 11511 - 5 and 11011 - 0.
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 2929.
It can be seen that there is no way in which they could have won 33 sets (and, therefore, the game) with 2929 points total.

Log in or sign up to be able to send submissions!