The contest has finished and you would like to enter the final standings. However, due to a corrupted file you have lost part of the scoreboard. In particular, the column indicating how many problems each team has solved is gone. You do still have the time penalties of all the teams and know that they are in the right order. You also remember how many problems the contest had. You wonder whether, given this information, it is possible to uniquely reconstruct the number of problems that each team has solved.
The input consists of:
- One line containing two integers:(
), the number of teams participating, and
(
), the number of contest problems.
-lines with on line
the time score
in minutes (
) of the team that is ranked in the
th place.
A positive time score of
indicates that a team has submitted their last accepted submission in the
th minute. A time score of
indicates that a team hasn't solved any problem.
The input always originates from a valid scoreboard.
If it is possible to uniquely reconstruct the scores of all the teams, outputlines containing the number of problems that the
th team has solved on the
th line. Otherwise, output "ambiguous".