Alien Dictionary
In the distant future, Earthlings have discovered a planet that was once home to intelligent beings unknown to humanity. Although the beings themselves are nowhere to be found, their library, filled with numerous written materials, has been uncovered. Scientists have eagerly begun deciphering these materials in hopes of discovering the whereabouts of these beings.
Upon analyzing the texts, it was determined that the alien writing system uses an alphabet consisting of N letters, with each word comprising M letters. Researchers have found what appears to be a dictionary, which is expected to greatly assist in understanding the language. The words in this dictionary are arranged not in lexicographical order, but in descending order of "importance." If two words share the same "importance," the lexicographically smaller word is listed first.
For any word a_1a_2...a_M, its "importance" is calculated as follows.
Consider this example: with N = 2 (number of letters) and M = 3 (word length), there are 8 possible words in this language. Let's list these words in lexicographical order. Here and throughout, the k-th letter of the alien alphabet is represented by the k-th letter of the Latin alphabet: aaa, aab, aba, abb, baa, bab, bba, and bbb. The matrix is as follows:
The importance of the words is calculated as:
aaa: 8 = 1 + 5 + 2;
aab: 12 = 1 + 5 + 6;
aba: 10 = 1 + 7 + 2;
abb: 14 = 1 + 7 + 6;
baa: 12 = 5 + 5 + 2;
bab: 16 = 5 + 5 + 6;
bba: 14 = 5 + 7 + 2;
bbb: 18 = 5 + 7 + 6,
and in the dictionary, the order of words is: bbb, bab, abb, bba, aab, baa, aba, aaa.
For further analysis, Earth scientists need to quickly determine which word appears at a specific position in this dictionary, following the described ordering rules: first by descending "importance," and if the "importance" is the same, in alphabetical order.
Given N, M, K, and the matrix p_jc, determine which word is at the K-th position in the dictionary of alien beings.
Input
The first line contains three integers: N, M, and K. Lines from 2 to (M+1) contain N integers each — the corresponding elements of the matrix p_jc (2 ≤ N ≤ 16, 1 ≤ M ≤ 10, 0 ≤ p_j_c ≤ 10^8, 1 ≤ K ≤ N^M).
Output
The output should be a single line containing the word that is located at the K-th position in the dictionary of alien beings.