#include<bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){
  int n,d,a,ans=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>d>>a;
    if(d==a){
      ans++;
    }
    else if(ans<3) ans=0;
  }
  if(ans>=3) cout<<"Yes\n";
  else cout<<"No\n";
}