%
% Summer Russian training informatics camp for school students
% Wednesday, June 29, 2016
%
% Problem: Egor Shcherbin
% Tests: Egor Shcherbin, Roman Andreev
% Graders: Egor Shcherbin
% Solutions: Egor Shcherbin, Pavel Kunyavskii, Nikolai Budin
% Idea: Andrei Stankevich
%
\begin{problem}{Plates at the Attic}{\textsl{standard input}}{\textsl{standard output}}{4 seconds}{256 megabytes}

Vanya and Misha were looking through the old things at the attic. Vanya found a set 
of $n$ metal plates and decided to find out the exact weights for of them. 
Unfortunately, there were no weights written on the plates, but Vanya managed to 
estimate them roughly and numbered the plates from $0$ to $n-1$ in the order of weight 
increasing.

By a lucky chance, Misha found the reference book ``Quality standard of the 
sets of $n$ plates'', where it was stated, that there are only $k$ different 
variants of the sets of $n$ plates, each one numbered from $0$ to $k-1$. 
Using this information and an old pair of scales, the guys decided to find out 
which set they have. But as long as Misha and Vanya know that you have seen 
the problem about scales from IOI 2015, they asked you to write a solution for their problem.

More specifically, you need to implement the function
\begin{center}\t{int identify\_set(int~n,~int~k,~long~long~**sets)}\end{center}
The arguments are:
\begin{shortitems}
\item
    \t{n} "--- the number of plates.
\item
    \t{k} "--- the number of different sets.
\item
    \t{sets} "--- 2-dimensional array of size \t{k}$\times$\t{n}, where 
    \t{sets[i][j]} is the weight of plate \t{j} from the set \t{i}. 
\end{shortitems}
This function should return the number of the set found by Vanya, or $-1$, if there is no possiblity to determine it.

Your function can use the following function for weighing the plates at the scales:
\begin{center}\t{int compare(int~first,~int~second)}\end{center}
The arguments are:
\begin{shortitems}
\item
    \t{first} "--- bit mask of the plates, which are placed to the first scale pad. It means, if 
    and only if the $i$-th bit of \t{first} equals to 1, you put the $i$-th plate to the first scale pad.
\item
    \t{second} "--- bit mask of the plates, which are placed to the second scale pad. The sets of the plates 
        can't intersect.
\end{shortitems}
This function returns $-1$, if the total weight of the plates at the first scale pad is less than 
the total weight of the plates at the second one, $0$, if the scales are balanced, and $1$, if the first scale pad 
weighs more.

As long as the scales are old, they can break down any moment, so for security 
you are allowed to use the function \t{compare} at most $T$ times. Otherwise, your 
solution will receive \t{Wrong Answer} verdict.

It's guaranteed, that each set has different weights of the plates and they 
come in the ascending order. It's guaranteed, that the found set 
is the one from the reference book.

\Scoring

Let $W$ be the weight of the heaviest plate from all the sets in a test.

\SubtaskWithScore{21} $n \le 12$, $k \le 14$, $W\le 10^9$, $T=540000$
\SubtaskWithScore{38} $n \le 18$, $k \le 26$, $W\le 10^9$, $T=k$
\SubtaskWithScore{30} $n \le 24$, $k = 2$, $W\le 10^9$, $T=k$
\SubtaskWithScore{11} $n \le 26$, $k \le 26$, $W\le 10^{15}$, $T=k$

\Example

\begin{example}
\exmpfile{001.input}{001.answer}%
\end{example}

Assume there are two variations for the set consisting of three plates: $(1,2,4)$ and $(1,3,4)$. 
You can put the first two plates to the first scale pad, and the third plate to the second one. 
The weighing shows that the first scale is lighter, but it is true only for the 
set $0$, which means the answer is $0$.

\end{problem}
