temp=input().split()
H,W,K,tempAns,ans=int(temp[0]),int(temp[1]),int(temp[2]),[],[]
s=[[int(i) for i in input()]for i in range(H)]
existHigh=[[True if s[i][j]>6 else False for j in range(W)] for i in range(H)]
for i1 in range(H):
for j1 in range(W):
if existHigh[i1][j1]==True:
place,point,used=[[i1,j1]],s[i1][j1],[[False for i in range(W)] for j in range(H)]
used[i1][j1]=True
for temp0 in range(K-1):
tempMax,tempMaxPlace=-1,[-1,-1]
for tempPlace in place:
if 0<tempPlace[0]:
if s[tempPlace[0]-1][tempPlace[1]]>tempMax and used[tempPlace[0]-1][tempPlace[1]]==False:
tempMax,tempMaxPlace=s[tempPlace[0]-1][tempPlace[1]],[tempPlace[0]-1,tempPlace[1]]
if tempPlace[0]<H-1:
if s[tempPlace[0]+1][tempPlace[1]]>tempMax and used[tempPlace[0]+1][tempPlace[1]]==False:
tempMax,tempMaxPlace=s[tempPlace[0]+1][tempPlace[1]],[tempPlace[0]+1,tempPlace[1]]
if 0<tempPlace[1]:
if s[tempPlace[0]][tempPlace[1]-1]>tempMax and used[tempPlace[0]][tempPlace[1]-1]==False:
tempMax,tempMaxPlace=s[tempPlace[0]][tempPlace[1]-1],[tempPlace[0],tempPlace[1]-1]
if tempPlace[1]<W-1:
if s[tempPlace[0]][tempPlace[1]+1]>tempMax and used[tempPlace[0]][tempPlace[1]+1]==False:
tempMax,tempMaxPlace=s[tempPlace[0]][tempPlace[1]+1],[tempPlace[0],tempPlace[1]+1]
if tempMax<1: break
if used[tempMaxPlace[0]][tempMaxPlace[1]]==False: used[tempMaxPlace[0]][tempMaxPlace[1]]=True
point*=s[tempMaxPlace[0]][tempMaxPlace[1]]
place+=[tempMaxPlace]
else:
tempAns.append([point,place])
tempAns.sort(key=lambda x:x[0])
used=[[False for i in range(W)] for j in range(H)]
for data in reversed(tempAns):
place=data[1]
for grid in place:
if used[grid[0]][grid[1]]: break
else:
ans.append(place)
for grid in place: used[grid[0]][grid[1]]=True
print(len(ans))
for i in ans:
for j in range(K):
print(str(i[j][0]+1)+" "+str(i[j][1]+1))