– Will you be the third?
Folk Set
At the start of the session, each student and teacher received a unique card, described by criteria. Each criterion can take a value of , , or .
A set is a group of three cards such that, for each of the criteria, one of the following holds:
All three cards have the same value for the criterion;
All three cards have different values for the criterion (that is, one card has , another has , the third has ).
The Group D' gathered in their cabin, and it is known that Alex Johnson will join them in the evening. What card should he bring to maximize the number of sets that include his card?
The first line contains two integers and (1 \le n \le 5000, 1 \le m \le 12, n < 3^m): the number of people in the group and the "dimension" of the set, respectively.
Each of the next lines describes a card: integers from to — the values of the corresponding criteria.
Output a card for Alex Johnson such that the number of sets including his card and the existing cards of Group D' is maximized. If there are several such cards, you may print any of them.
Example 1