#include<iostream>
using namespace std;
int main()
{
  int n,a,b,i,res=0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a >> b;
    if(a==b)
      res++;
    else
      res=0;
    if(res>2){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}