while True:
try:
W, H = map(int, input().split())
N = int(input())
L = []
Q = []
for _ in range(W):
L.append(input().split())
for i in range(W):
for j in range(H):
if L[i][j] != '0':
Q.append([L[i][j], i, j])
Q = sorted(Q, key=lambda x: x[0])
if len(Q) >= N:
for i in range(N):
print(Q[i][1], Q[i][2])
else:
print("Mission fail.")
except EOFError:
break