#P1986. Child's play

Child's play

题目描述

Ema is playing a new game with her friends!

Each of the n players has a number on its forehead. The numbers range from 1 to m, and no two players have the same number. A player can see everyone else's number, but not the number on itself. All players know the lower bound 1 and the upper bound m beforehand.

Players win by pointing out how many other players have a number smaller than its own number. To decide the winner, each turn every player writes down whether or not it can win using the information from previous turns, then everyone shows the result simultaneously. The game ends when at least one player wins on some turn.

Given the starting situation, determine when will the game end, and who wins at the end. It can be shown that the game will always end.

输入格式

输出格式

样例

3 
3 5 
2 3 4 
4 18 
7 8 15 17 
5 16 
4 6 8 11 13
2 3 
1 2 3 
8 2 
2 3 
7 1 
2

提示

by 艾拉拉