// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
#include <ctime>
using namespace std;
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 

//========================TypeDefs===================================
typedef int elem_t;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvl;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 

 
//=========================MACROS====================================

#define shen01orz() main()
#define max(a,b) (a<b?b:a)
#define min(a,b) (a>b?b:a)
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define all(c) (c).begin(),(c).end() //handy for function like "sort()"
#define ll long long //data types used often, but you don't want to type them time by time
#define IOS ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);//to synchronize the input of cin and scanf
#define INF (long long)1e18
#define intINF (int)1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
#define pb push_back
// directions
const int fx[4][2] = {{0,1}, {-1,0}, {0,-1}, {1,0}};
const int fxx[9][2] = {{0,0},{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
const ll mod = 1000000007;
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define clz(n) __builtin_clz(n)
#define clzll(n) __builtin_clzll(n)
#define ctz(n) __builtin_ctz(n)

//oset
#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetlli tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update>
 
#define ofk order_of_key
#define fbo find_by_order

 
//==============================FUNCTIONS===========================================
inline ll power(ll x, ll y, ll p = mod)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
 
inline ll modadd(ll a, ll b, ll m = mod)
{
    a += b;
    if (a >= m)
        a -= m;
    return a;
}
 
inline ll modmul(ll a, ll b, ll m = mod)
{
    return ((a % m) * (b % m)) % m;
}
 
inline ll modi(ll a, ll m = mod) { return power(a, m - 2, m); }
 
long long int inverse(long long int i,ll m=mod){
    if(i==1) return 1;
    return (m - ((m/i)*inverse(m%i))%m+m)%m;
}

ll rand_int(ll l, ll r) 
{ //[l, r]
    #ifdef LOCAL
    static mt19937_64 gen;
    #else
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    #endif
    return uniform_int_distribution<ll>(l, r)(gen);
}

void solve()
{
    ll n;
    cin>>n;
    ll cnt = 0;
    vector<ii> a(n);
    for(ll i=0;i<n;i++)
    {
        cin>>a[i].fi>>a[i].se;
    }
    for(ll i=0;i<n-2;i++)
    {
        if(a[i].fi==a[i].se&&a[i+1].fi==a[i+1].se&&a[i+2].fi==a[i+2].se)
        {
            cout<<"Yes";
            exit(0);
        }
    }
    cout<<"No";
}

elem_t shen01orz()
{
    long long t;
    t = 1;
    while(t--)
    {
        solve();
    }
}



Measured memory_bytes: 3640