include <bits/stdc++.h>
using namespace std;

int main() {
  
  int N;
  cin >> N >> endl;
  
  vector<int> data(N);
  
  for ( int i = 0; i < N; i++ ) {
    
    cin >> data.at(N) >> endl;
    
  }
  
  bool ans = false;
  
  for ( int i = 0; i < N - 1; i++ ) {
    
	  if ( data.at(i) == data.at(i + 1) ) {
    
    	ans = true;
    
  	  }
  }
  
  if ( ans ) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}
