~/algor $ cat problems/matritsa-elementni-qidirish
Find an element
Easy
1000 ms
128 MB
27%
An integer matrix of size $n \times m$ and an integer $x$ are given. Find the row and column numbers of the first occurrence of $x$ in the matrix (numbering starts at $1$): the rows are scanned top to bottom, each row left to right.
Input
The first line contains $n$ and $m$. Each of the next $n$ lines contains $m$ integers. The last line contains an integer $x$.
Output
One line with two space-separated integers: the row number and the column number. If $x$ is not in the matrix, print a single number -1.
Note
$1 \le n, m \le 200$
$-1000 \le a_{i,j} \le 1000$
$-1000 \le x \le 1000$
Examples
Input #1
2 3 1 -2 3 -4 5 6 5
Output #1
2 2
Input #2
2 2 1 2 3 4 9
Output #2
-1