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