import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int K = sc.nextInt(); int[][] mat = new int[N][M]; for(int i = 0; i < N; i++){ for(int j = 0; j < M; j++){ mat[i][j] = sc.nextInt(); } } int x = 0; int y = M - 1; while(x < N && y >= 0){ if(mat[x][y] == K){ System.out.println("Yes"); return; }else if(mat[x][y] < K){ x++; }else{ y--; } } System.out.println("No"); } }