#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define itf it->first
#define its it->second
#define fo(i,a,b) for(i=a;i<(ll)b;++i)
#define foe(i,a,b) for(i=a;i<=(ll)b;++i)
#define rfo(i,a,b) for(i=a;i>(ll)b;--i)
#define rfoe(i,a,b) for(i=a;i>=(ll)b;--i)
#define trans(x) for(auto &val:x)
#define all(x) x.begin(), x.end()
#define itoj(x,i,j) x.begin()+i,x.begin()+j
#define uniq(x) x.erase(unique(x.begin(),x.end()),x.end())
#define subv(x,i,j) vector<long long int>(x.begin()+i,x.begin()+j)
#define subs(x,i,j) string(x.begin()+i,x.begin()+j)
#define vll vector <long long int>
#define mll map<long long int, long long int>
#define umll unordered_map<long long int, long long int>
#define pll pair <long long int, long long int>
#define pqll priority_queue<long long int>
#define vpll vector <pair<long long int, long long int>>
#define ub(x,k) upper_bound(x.begin(),x.end(),k)
#define lb(x,k) lower_bound(x.begin(),x.end(),k)
#define last(x) x[x.size()-1]
#define boost ios::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr)
#define time (chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now()-STi).count())*(1e-9)
#define ret(x) {cout<<x; return;}
#define cnt1(x) __builtin_popcountll(x)
#define lsb(x) __builtin_ffsll(x)
#define ctz(x) __builtin_ctzll(x)
#define inv(x) vector<ll> x(n);trans(x)cin>>val;
#define ins(x) vector<string> x(n);trans(x)cin>>val;
#define endl "\n"

const auto STi =chrono::high_resolution_clock::now();
const ll MOD =1000000007;
const ll mod =998244353;
const ll M =1000001;
const ld pi =acos(-1);
const vector<string> month={"","January","February","March","April","May","June","July","August","September","October","November","December"};
const vector<int> days={0,31,28,31,30,31,30,31,31,30,31,30,31};
const vector<string> week={"","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};

void YN(bool b){(b)?cout<<"YES":cout<<"NO";}
void Yn(bool b){(b)?cout<<"Yes":cout<<"No";}
void yn(bool b){(b)?cout<<"yes":cout<<"no";}

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

class sieve{
public:  bool a[M]={1,1};  vll v;
sieve(ll n=M)
{ ll j,t; 
for(j=4;j<n;j+=2) a[j]=1;
v.eb(2);
for(j=3;j<n;j+=2){
if(a[j]) continue;
v.eb(j);
for(t=j*j;t<n;t+=2*j) a[t]=1;
}}};

ll mul(ll x, ll y, ll m) {ll res=0;x%=m; while(y){ if(y&1)res=(res+x)%m; x=(2*x)%m;y>>=1;}return res;} 

ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}

ll power(ll x, ll y, ll m) {ll res=1; x%=m; while(y){if(y&1)res=mul(res,x,m); y>>=1; x=mul(x,x,m);} return res;}

vll fact;
void factorial(ll n=M){
fact.resize(n+1); fact[0]=1; ll j;
foe(j,1,n)fact[j]=(j*fact[j-1])%MOD;}

bool prime(ll x){ if(x<2)return false; if(x<4)return true; if(x%2==0||x%3==0)return false; ll j=5; while(j*j<=x) {if(x%j==0||x%(j+2)==0)return false; j+=6;} return true;}

ll digsum(ll n){ll c=0; while(n){c+=n%10; n/=10;}
return c;}

template <typename T>
void print(T u){ cout<<endl; 
for(auto &j:u)cout<<j<<" ";}

ll fun(ll n){
ll s=0,c=0;

return 0;
}

void solve(void);
int main()
{      boost;
       ll t=1;
   //    cin>>t;
      while (t--) { solve();  cout<<"\n"; cerr<<"\n"; }    
            cerr<<fixed<<time<<" seconds";
       return 0;
}

void solve()
{
ll n,c=0,a,b;  bool f=0;
cin>>n;
while (n--){
cin>>a>>b;
if(a==b)   c++;
else   c=0;

if(c==3)ret("Yes");
}

cout<<"No";
}

Measured memory_bytes: 3872