#include<bits/stdc++.h> using namespace std; int main() { int n,m,k; cin >> n >> m >> k; int a[n][m]; for(int i = 0;i < n;++i) for(int j = 0;j < m; ++j) { cin >> a[i][j]; } int x ; int col = m - 1; int row = 0; while(row < n && col > -1) { if(k == a[row][col]) { cout << "Yes"<< endl; return 0; } else if(k > a[row][col]) row++; else col--; } cout << "No" << endl; }