Set
− Will you be the third?
Russian Folk Set
At the start of the shift, each student and teacher received a unique card, characterized by m criteria. The values for these criteria are represented by 1, 2, and 3.
A set consists of three cards where, for each of the m criteria, one of the following conditions holds:
All three cards have the same value for that criterion.
All three cards have different values for that criterion, specifically one card has 1, another 2, and the third 3.
The D' parallel group gathered in their cabin, and it is known that Andriy Sergiyovych will join them in the evening. What card should he bring to maximize the number of sets formed with his card included?
Input
The first line of the input contains two integers, n and m (1 ≤ n ≤ 5000, 1 ≤ m ≤ 12, n < 3^m), representing the number of people in the group and the "dimension" of the set, respectively.
Each of the following n lines provides the description of a card, consisting of m integers ranging from 1 to 3, which denote the values of the respective criteria.
Output
Output a card for Andriy Sergiyovych that maximizes the number of sets formed with his card and the existing cards in the D' parallel. If there are multiple such cards, you may print any one of them.