n,m = map(int,input().split())
lines = []
for i in range(n):
    temp = list(map(int,input().split()))
    lines.extend(temp)
max_num = max(lines)
max_index = lines.index(max_num)
i = (max_index ) // m + 1
j = max_index - (i-1)*m +1
print(i,j)