#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ull unsigned long long
#define ld long double
 
void Free_palestine() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
 
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const int MAXN = 105;
int a[MAXN][MAXN];

signed main(){
  Free_palestine();
  
  int n, m;  cin >> n >> m;
  
  for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    int x;
    cin >> x;

    
    bool found = false;
  for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == x) {
                found = true;
                break; 
            }
        }
        if (found) break; 
    }

    if (found) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }

    return 0;
}