{"raw_statement":[{"iden":"statement","content":"Constantine and Mike are playing the board game «Wrath of Elves». There are n races and m classes of characters in this game. Each character is described by his race and class. For each race and each class there is exactly one character of this race and this class. The power of the character of the i-th race and the j-th class equals to aij, and both players know it perfectly.\n\nNow Constantine will choose a character for himself. Before that Mike can ban one race *and* one class so that Constantine would not be able to choose characters of this race *or* of this class. Of course, Mike does his best to leave Constantine the weakest possible character, while Constantine, on the contrary, chooses the strongest character. Which race and class Mike should ban?\n\nThe first line contains two integers n and m (2 ≤ n, m ≤ 1000) separated by a space — the number of races and classes in the game «Wrath of Elves», correspondingly.\n\nThe next n lines contain m integers each, separated by a space. The j-th number in the i-th of these lines is aij (1 ≤ aij ≤ 109).\n\nIn the only line output two integers separated by a space — the number of race and the number of class Mike should ban. Races and classes are numbered from one. If there are several possible answers, output any of them.\n\n"},{"iden":"input","content":"The first line contains two integers n and m (2 ≤ n, m ≤ 1000) separated by a space — the number of races and classes in the game «Wrath of Elves», correspondingly.The next n lines contain m integers each, separated by a space. The j-th number in the i-th of these lines is aij (1 ≤ aij ≤ 109)."},{"iden":"output","content":"In the only line output two integers separated by a space — the number of race and the number of class Mike should ban. Races and classes are numbered from one. If there are several possible answers, output any of them."},{"iden":"examples","content":"Input2 21 23 4Output2 2Input3 41 3 5 79 11 2 46 8 10 12Output3 2"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the length of the array.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of integers where $ 1 \\leq a_i \\leq 50 $.  \nLet $ B = (b_1, b_2, \\dots, b_n) $ be the output sequence, where each $ b_i $ is defined as follows.\n\n**Constraints**  \n$ 1 \\leq n \\leq 10^5 $\n\n**Objective**  \nFor each $ i \\in \\{1, \\dots, n\\} $, define:  \n$$\nb_i = \n\\begin{cases}\na_j & \\text{if } j = \\min\\{ k \\in \\{i+1, \\dots, n\\} \\mid a_k > a_i \\} \\\\\n-1 & \\text{if no such } j \\text{ exists}\n\\end{cases}\n$$  \nOutput $ B = (b_1, b_2, \\dots, b_n) $.","simple_statement":"For each element in the array, find the first larger element to its right. If none exists, output -1.","has_page_source":false}