aa =[]
for i in range (9):
a = list(map(int, input().split()))
aa.append(a)
def find_index (ary,v):
for i in range (9):
for j in range(9) :
if ary[i][j] == v:
return i+1,j+1 #ํํ
return None
max = aa[0][0]
for i in aa:
for j in i:
if j > max:
max = j
print(max)
print(*find_index(aa,max), sep=" ")