Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/matritsa-eng-katta-element-orni

Position of the largest element

Easy 1000 ms 128 MB 27%
Share

An integer matrix of size $n \times m$ is given. Find the row and column numbers of its largest element (numbering starts at $1$). If there are several, take the one met first when the rows are scanned top to bottom and each row left to right.

The row and column of the largest element of the matrix

Input

The first line contains two positive integers $n$ and $m$. Each of the next $n$ lines contains $m$ integers.

Output

One line with two space-separated integers: the row number and the column number.

Note

$1 \le n, m \le 200$
$-1000 \le a_{i,j} \le 1000$

Examples

Input #1
3 3
1 9 2
9 0 3
4 5 6
Output #1
1 2
Input #2
1 1
-5
Output #2
1 1

Sign in to submit a solution

Signing up is free and takes a minute.