n, m, k = list(map(int, input().split()))
matrix = []
for i in range(n):
matrix.append(list(map(int, input().split())))
i, j = n - 1, 0
while n > i >= 0 and 0 <= j < m:
if matrix[i][j] == k:
print("Yes")
exit()
if matrix[i][j] > k:
i -= 1
else:
j += 1
print("No")