#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
 #define ll long long
 typedef unsigned long long ull;
 typedef long double ld;

 #define pii         pair<ll ,ll >
 #define vi          vector<ll >
 #define vii         vector<pii>
 #define mi          unordered_map<ll ,ll >
 #define mii         map<pii,int>
 #define all(a)      (a).begin(),(a).end()
 #define F           first
 #define S           second
 #define pb          push_back
 #define hell        1000000007 
 #define rep(i,a,b)  for(ll int i=a;i<b;i++)
 #define take        for(ll i=0;i<n;i++) cin>>v[i];
 #define MAXN        500005



 #define allr(c) (c).rbegin(),(c).rend()
 int mod = 1000000007;
 const int inf = 1034567891;
 const long long LL_INF = 1234567890123456789ll;
 #define PI 3.14159265
 #define endl '\n'
 #define F first
 #define S second
 #define debug(x) cout << #x << " = " << x << endl;
 #define TRACE

 #ifdef TRACE
 #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
 template <typename Arg1>
 void __f(const char* name, Arg1&& arg1)
 {
   cout << name << " : " << arg1 << endl;
 }
 template <typename Arg1, typename... Args>
 void __f(const char* names, Arg1&& arg1, Args&&... args)
 {
   const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
 }
 #else
 #define trace(...)
 #endif
      
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
       
        
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(long long x, long long y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(ll x, ll y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(ll x, ll y){ return (x * 1ll * y) % mod;}
inline ll powr(ll a, ll b){
    int x = 1 % mod;
     while(b)
     {
         if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
      }
     return x;
}
inline long long inv(long long a){ return powr(a, mod - 2);}
ll Powb(ll b,ll n,ll m)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2,m);
    if(n%2==0){return (temp*temp)%m;}
    else{return (b*((temp*temp)%m))%m;}
}

void solve()
{
    ll n;
	cin>>n;
	vii v(n);
	ll t=0;
	ll k=0;
	for(ll i=0;i<n;i++)
	{
		cin>>v[i].F;
		cin>>v[i].S;
		if(v[i].F==v[i].S)
		{
			t++;
		}
		else
		{
			t=0;
		}
		k=max(k,t);
	
	} 
	if(k>=3) 
	{
		cout<<"Yes";
												  } 
												  else
												  {
												  		cout<<"No";
																							   }                                             
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);                                                        
    ll t;
                                                      
    t=1;
                                                         
                                                         
   // cin>>t;
    while(t--)
    solve();
}


Measured memory_bytes: 3652