By Bruno Junqueira Adami Brazil
The BWS lottery is done annually. In it N people bet by choosing K numbers each. Formally, we can say that Bij is the j-th amount wagered by the i-th person. So the organizers choose positive integers K. The chosen numbers are called W1, W2, ..., WK.
Winners are calculated as follows:
The organizers want to know: can you choose the numbers W1, W2, ..., WK so that there is no winner subset of participants?
The first line contains the numbers N (1 ≤ N ≤ 104) and K (3 ≤ K ≤ 50), representing the number of participants and the amount of numbers bet per person respectively. People bet on integers greater than 1 and smaller than 50, inclusive. Each of the following N lines contains K numbers, representing the bets of each person, one per line.
Print 'S' if possible or 'N' otherwise.
Input Samples | Output Samples |
2 3 1 2 3 5 6 7 |
S |
3 3 3 2 1 6 5 4 4 4 4 |
S |
4 3 9 4 7 4 4 4 2 7 2 2 2 1 |
N |