eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

The Table

The Table

Ліміт часу 10 секунд
Ліміт використання пам'яті 64 MiB

Consider the table of 32-bit signed integers with n rows and m columns. The columns are numbered from 1 to m beginning from the left side of the table. Let A_i (1im) is the product of all numbers in the i-th column. Find the maximum of these products and print the column number where this maximum product is achieved. If there are many such columns, print the largest number of the column.

Вхідні дані

Consists of multiple tests. Each test begins with a line with two integers m and n (1m20, 1n1000). Each of the next n lines contains m32-bit signed integers. Output

For each test case print on a separate line the column number with the maximum product. If there are several of them – print the largest number of such column.

Приклад

Вхідні дані #1
3 3
20 10 30
15 20 20
30 30 20
3 2
2 -2 2
2 -2 2
Вихідні дані #1
3
3