#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ctime>
#include<deque>
using namespace std;

#define fr                first
#define se                second
#define int               long long
#define pb                push_back
#define mp                make_pair
#define pii               pair<int,int>
#define vi                vector<int>
#define vvi                vector<vector<int>>
#define mi                map<int,int>
#define pq                priority_queue<int>
#define set_bits(x)       __builtin_popcountll(x)
#define mod               1000000007
#define inf               1e18                        //Defining infinity the overflow of int
#define ps(x,y)           fixed<<setprecision(y)<<x   //for defining the precision of the decimal upto y places.
#define zrosetbits(x)     __builtin_ctzll(x)         //it will give no of 0's before the first 1 from the right.
#define mk(a,n,type)      type *a=new type[n];
#define test(t)           int t; cin>>t; while(t--)
#define no                cout<<"No\n";
#define yes               cout<<"Yes\n";
#define NO                cout<<"NO\n";
#define YES               cout<<"YES\n";
//#define for(i,n)          for(int i=0;i<n;i++)
//#define for(j,n)          for(int j=0;j<n;j++)
// #define forn(i,n)               for(int i=0;i<n;i--)



//**********************************************************************************************************
struct custom_hash
{
  static uint64_t splitmix64(uint64_t x)
  {
    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }

  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

#define safemap               unordered_map<int,int,custom_hash>

//*********************************************************************************************************

void io()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin.tie(0);
}

int gcd(int a, int b)
{
  if (a == 0)
    return b;
  return gcd(b % a, a);
}

int div(int a, int b, int m)
{
  if (a % m == 0)
    return ((b / m) - (a / m) + 1);
  else
    return ((b / m) - (a / m));

}

const int N = 2e5 + 5;
// vpi G[N + 1];
// int vis[N + 1];
// vi G[N + 1];
// int vis[N + 1];
//int par[N];


struct dsu
{
  vi par;

  dsu(int n)
  {
    par.resize(n + 1);
    iota(par.begin(), par.end(), 0);
  }

  int get(int x)    //Get the super parent
  {
    if (par[x] == x)
      return par[x];

    par[x] = get(par[x]);
    return par[x];

  }

  void unite(int x, int y)
  {
    x = get(x);
    y = get(y);

    par[x] = par[y];
  }

} ;



#define MAX_SIZE 1005

void SieveOfEratosthenes(vector<int> &a)
{
  bool prime[MAX_SIZE];
  memset(prime, true, sizeof(prime));

  for (int p = 2; p * p < MAX_SIZE; p++)
  {
    if (prime[p] == true)
    {
      for (int i = p * p; i < MAX_SIZE; i += p)
        prime[i] = false;
    }
  }
  for (long long p = 2; p < MAX_SIZE; p++)
  { if (prime[p])
      a[p] = p;
  }
}



bool cmp(pair<int, pair<int, int>> a, pair<int, pair<int, int>> b)
{

//Checking for the year
  if (a.second.second == b.second.second)
  {
    if (a.second.first == b.second.first)
    {
      return a.first < b.first;
    }
    else
      return a.second.first < b.second.first;
  }
  else
    return a.second.second < b.second.second;
}





int32_t main()
{

  io();
  clock_t begin = clock();

  int te = 1;

  //vector<int> a(MAX_SIZE, 0);
  //SieveOfEratosthenes(a);

  // test(t)
  // {

  int n, k, m, p, q, x, y;
  int small = INT_MIN;

  cin >> n ;

  int a[n] = {0};
  int b[n] = {0};

  // int a[n] = {0};

  for (int i = 0; i < n; i++)
    cin >> a[i] >> b[i];

  int ct = 0;

  for (int i = 0; i < n; i++)
  {
    int ctr = 0;

    if (a[i] == b[i])
    {
      if (i < n - 2 and a[i + 1] == b[i + 1] and a[i + 2] == b[i + 2] )
        ctr += 3;

    }
    if (ctr == 3)
      ct++;
  }


  if (ct > 0)
    cout << "Yes\n";
  else
    cout << "No\n";


//te++;
// double c_time = (double) (clock() - begin) / CLOCKS_PER_SEC;
// cout << ps(c_time, 4) << " seconds\n";
// }

  return 0;
}


Measured memory_bytes: 3652