/**
 * Created By: Anonyman637
 * Created On: 9/19/2020 6:10:08 PM
 */

/* =============================================================================
   ================================== HEADERS ==================================
   ========================================================================== */

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

/* =============================================================================
   ================================= TYPEDEFS ==================================
   ========================================================================== */

using namespace std;

typedef char i8;
typedef short i16;
typedef int i32;
typedef long long i64;

typedef unsigned char ui8;
typedef unsigned short ui16;
typedef unsigned int ui32;
typedef unsigned long long ui64;

typedef double db;
typedef long double ldb;

typedef vector<i32> vi32;
typedef pair<i32, i32> pi32;

/* =============================================================================
   ================================== MACROS ===================================
   ========================================================================== */

#ifdef DEBUG
#define debug(format, ...) printf(format, __VA_ARGS__)
#else
#define debug(format, ...) 
#endif

#define NOCSYNCIOS ios_base::sync_with_stdio(false); cin.tie(NULL)

#define FOREACH(it, cont) for (const auto& it : (cont)) 

#define ALL(cont) (cont).begin(), (cont).end()
#define RALL(cont) (cont).end(), (cont).begin()
#define SP(x) fixed << setprecision(x)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))

#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define sz size()

#define EPS 1e-9
#define MOD 1000000007
#define I32_MAX 2147483647

/* =============================================================================
   =================================== SETUP ===================================
   ========================================================================== */

i32 setup() {

#if FILEIO
	#define FILEI
	if(freopen(OUTFILE, "w", stdout) == NULL) return 402;
#endif

#ifdef FILEI
	if(freopen(INFILE, "r", stdin) == NULL) return 401;
#endif

	return 0;
}

/* =============================================================================
   ================================== GLOBALS ==================================
   ========================================================================== */

const double pi=acos(-1.0);

/* =============================================================================
   ================================= FUNCTIONS =================================
   ========================================================================== */

i32 main() {

	i32 errorInSetup = setup();
	if (errorInSetup) exit(errorInSetup);
	NOCSYNCIOS;

	i32 i, t;
	i32 n;
	cin >> n;

	i32 di, dj;
	i32 cnt = 0;
	i32 doubletFound = false;
	while (n--) {
		cin >> di >> dj;
		if (di == dj) {
			++cnt;
		} else {
			cnt = 0;
		}

		if (cnt == 3) {
			doubletFound = true;
			break;
		}

	}

	if (doubletFound) {
		cout << "Yes" << "\n";
	} else {
		cout << "No" << "\n";
	}
	
	exit(0);
}


Measured memory_bytes: 3648