// Motto:-Fail early,Fail Often,Fail Forward.
//	while(true)
// {
//     if(AC)
//     {
//         break;
//     }
//     else if(Contest Over)
//     {
//         Try.
//         Check out Editorial.
//         Understand.
//         Find out your Mistake.
//         Learn the topic (if new).
//         Solve Problems on that topic (if new).
//         Upsolve that problem.
//         break;
//     }
//     else
//     {
//         Try.
//         Use Pen-Paper.
//         Find errors, edge cases, etc.
//         continue;
//     }
// }
	#include<bits/stdc++.h>
	using namespace std;
	//=============================LOL======================
	#define int         long long
    #define double      long double
    #define pb          push_back
    #define pf          push_front
    #define pii         pair<int,int>
    #define vi          vector<int>
    #define vnn         vector<vector<int>>
    #define vii         vector<pii>
    #define vs          vector<string>
    #define all(a)      (a).begin(),(a).end()
    #define rall(a)     (a).rbegin(),(a).rend()
    #define x           first
    #define y           second
    #define endl        '\n'
	#define sz(x)       (int)(x).size()
	#define thunder     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
	//=============================LOL========================
	//++++++++++++++++++++++++Optimisations+++++++++++++++
	//#pragma GCC optimize("O1") 
	//#pragma GCC optimize("O2")
	//#pragma GCC optimize("O3") 
	//#pragma GCC optimize("Os") 
	//#pragma GCC optimize("Ofast") 
	//#pragma GCC optimize("Ofast")  
	//#pragma GCC target("avx,avx2,fma")
	//++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
	//=========================Chal,Nikal.ab==========================
	#define fo(i,l,u)   for(i=l;i<u;i++)
    #define rfo(i,l,u)  for(i=l;i>=u;i--)
    #define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
    #define _init(b)     memset(b,-1,sizeof(b))
    #define _init0(b)     memset(b,0,sizeof(b))
    #define MOD         1000000007
    #define hell        998244353
    #define output(x) cout << (x ? "YES" : "NO")<<endl;
	#define Output(x) cout << (x ? "Yes" : "No")<<endl;
	//=========================Chal,Nikal.ab=============================
	//---------------------------Hushiyari mat dikha---------------------------------
	#define MOD2 (998244353)
    #define MOD3 (1000000009)
    #define PI acos(-1)
    #define eps (1e-8)
	#define INF (1e18) 
	template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
	template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
	template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
	template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
	ifstream cinn("in.txt");ofstream coutt("out.txt");
	int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;} 
	//---------------------------Hushiyari mat dikha--------------------------------------
	int gcd(int a, int b) 
    { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);    
    }
    signed main()
    {
        thunder;
        int t,n,m,r,c,h,a,b,k,f,f2,t1,t2,i,j,ans;
        cin>>t;
        c=0,f=0;
        while(t--)
        {
            cin>>a>>b;
            if(a==b) c++;
            else 
            {
                if(c>=3) {f=1;}
                c=0;
            }
        }
        if(c>=3) f=1;
        if(f==1) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
       
    }

Measured memory_bytes: 3656