P9791 [NERC 2018] Alice the Fan

Background

Translated from Problem A of [NERC 2018](https://neerc.ifmo.ru/archive/2018/neerc-2018-statement.pdf).

Description

Alice likes watching volleyball matches, and she especially likes watching Team A. The rules of a volleyball match are as follows: - A match has at most $5$ sets. - In the first $4$ sets, a team must score at least $25$ points to win the set. In the $5$th set, only $15$ points are required. - If, within a set, one side meets the winning condition **but** the score difference between the two sides is less than $2$, it is not considered a win. - A team that wins $3$ sets wins the match, and the match ends immediately at that moment. Now you are given the numbers of sets won by Team A and Team B, and you need to determine the best possible match score for Team A, or determine that the match has not ended yet. (Note: In this problem, the “best” match score is defined as follows: if Team A can win, make the difference in the number of sets between the two teams as large as possible; otherwise, make it as small as possible.)

Input Format

The first line contains an integer $m(1 \leq m \leq 50000)$, indicating that Team A has played $m$ different matches. The next $m$ lines each contain two integers $a(1 \leq a \leq 200)$ and $b(1 \leq b \leq 200)$, representing the points scored by Team A and Team B in that match.

Output Format

For each match, output Team A’s best match score situation and one **set-by-set** score sequence that satisfies the conditions, or determine that it is impossible and output `Impossible`.

Explanation/Hint

The testdata guarantees that $1 \leq m \leq 50000$ and $1 \leq a,b \leq 200$. Note: Due to technical reasons, if the SPJ shows UKE during judging, it is because there is an error in your code, causing the SPJ to read one more or one fewer character, and then it cannot judge normally. Translated by ChatGPT 5