시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB28221976.000%

문제

In a soccer match, a team either earns a win, tie or loss. A win is worth 3 points, a tie is worth 1 point, and a loss is worth 0 points. Unfortunately, due to poor record-keeping, some leagues have only saved the number of total matches played and the number of points each team has earned. One of these leagues has asked you to write a program to recreate the possible combinations of wins, ties and losses for certain teams in the league.

Given the number of games played by a soccer team in a season and the number of points earned by the team, list each possible combination of wins, ties and losses that the team could have gotten to achieve the given total points.

입력

The first input line contains a positive integer, n, indicating the number of teams for which you are to reconstruct possible records. The teams’ information are on the following n input lines, one team per line. Each of these lines contains two space separated integers: g (0 < g ≤ 100), and p (0 ≤ p ≤ 300), representing the number of games played and the total points earned by the team, respectively. It is guaranteed that there is at least one possible combination of wins, ties and losses that is consistent with the given information for each team.

출력

For each team, first output header info with the following format:

Team #k
Games: g
Points: p
Possible records:

where k is the team number (starting with 1), g is the number of games, and p is the total points earned. Following the above header info, output the possible records, each on a separate line with the format:

w-t-l

where w is the number of wins, t is the number of ties and l is the number of losses. Print these by descending order of wins.

Leave a blank line after the output for each team. Follow the format illustrated in Sample Output.

예제 입력 1

3
6 10
1 3
4 4

예제 출력 1

Team #1
Games: 6
Points: 10
Possible records:
3-1-2
2-4-0

Team #2
Games: 1
Points: 3
Possible records:
1-0-0

Team #3
Games: 4
Points: 4
Possible records:
1-1-2
0-4-0