#include<iostream>
using namespace std;
int main()
{
  int t,a,b;
  cin>>t;
  bool prev=true;
  int c=0;
  while(t--)
  {
    cin>>a>>b;
    if(a==b)
    {
      c+=1;
    }
    else
      c=0;
    if(c>=3)
    {
      prev=false;
    }
  }
  if(prev)
    cout<<"No";
  else
    cout<<"Yes";
}