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

int main()
{
  long n; cin>>n;
  
  int cnt = 0;
  bool ans = false;
  for(int i=0; i<n; i++)
  {
    int a, b; cin>>a>>b;
    if(a == b)
      cnt++;
    else
      cnt = 0;
    if(cnt == 3)
      ans = true;
  }
  cout<<(ans ? "Yes": "No");
}