//#pragma region ALL(include define etc)
#include <iostream>   // swap(a, b)
#include <string>
#include <cmath>      // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592)
#include <vector>     // vec.push_back(a) vec.pop_back()
#include <algorithm>  // max(a, b) min(a, b) reverse() sort()
#include <functional> // sort(a, a + N, greater<型>());
#include <limits>
#include <math.h>
#include <iomanip>
#define int long long
//#define int double
//#define int unsigned long long
#define ll long long
#define double long double
using namespace std;
//#pragma endregion

signed main()
{
	// 10^18 = 1000000000000000000

	//int h1, h2, m1, m2, k;
	//int box, box1,box2;

	//int N;
	int n;
	//char n;
	//int a, b, c;
	//int m;
	//int h, w, x;
	int k;
	//int d,t,s;
	//int t;
	//string s;
	//string t;
	//int m1, m2;
	//int a, b, c, k;
	int x, y;
	//int a, b, c, d;

	string s;
	string t;
	//string s[100000];
	//string c[7];
	//int a[100000];
	//int b[200000];
	//int a[2000000] = { 0 };
	//int b[2000000] = { 0 };
	//int a[20000] = { 0 };
	//int b[20000] = { 0 };
	//vector<int>a(2000000);
	//vector<int>b(2000000);

	//int aaa = 0;
	//int bbb = 0;

	int box[20000] = { 0 };
	//char box[20000];
	//int a[2000000] = { 0 };
	//int box = 0;
	//int box[7][7] = { 0 };
	//int box2;
	//int p[1111];
	//int x[2000], y[2000];
	//int l[100];
	int d[111] = { 0 };
	int d2[111] = { 0 };

	for (int i = 0; i < 111; i++)
	{
		d2[i] = -1;
	}


	//long double aaa;

	int count = 0;
	int count1 = 0;
	int count2 = 0;
	int count3 = 0;
	int count4 = 0;
	//int k, d;
	//int a = 0;
	int all = 0;
	//double all;
	//double a, b;
	//double h, m;
	//int a[30000] = { 0 };
	//double c, d, e;

	//double mbox, hbox;
	//double box, box2;

	//bool flag = true;
	bool flag = false;

	//string str;

	//cin >> h1 >> m1 >> h2 >> m2 >> k;
	cin >> n;
	//cin >> a >> b >> c >> d;
	//cin >> s;
	//cin >> t;
	//cin >> d >> t >> s;
	//cin >> n >> x >> t;

	for (int i = 0; i < n; i++)
	{
		cin >> d[i] >> d2[i];
	}

	for (int i = 0; i < n; i++)
	{
		if (d[i] == d2[i])
		{
			if (d[i + 1] == d2[i + 1] && d[i + 2] == d2[i + 2])
			{
				flag = true;
			}
		}
	}

	//count = s.length();
	////cout << count;

	//if (s[count - 1] == 's')
	//{
	//	cout << s << "es\n";
	//}
	//else
	//{
	//	cout << s << "s\n";
	//}
	
	//count1 = a * c;
	//count2 = a * d;
	//count3 = b * c;
	//count4 = b * d;

	//count = max(count1, count2);
	//count = max(count, count3);
	//count = max(count, count4);

	//all = count;
	/*count = d / s;

	if (count <= t)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}*/

	/*do {
		for (int i = 0; i < n; i++) {
			if (i % n == 0)
				cout << "\n";
			cout << a[i] << " ";
		}
	} while (next_permutation(a, a + n));*/

	//getline(cin, s);

	/*for (int i = 0; i < count; i++)
	{
		all += s[i] - '0';
	}*/

	//n = s.length();

	//sort(box, box + count);
	//sort(p, p + n);
	//n = n - 'Z';

	//box = n % 26;

	//for (int i = 0; i < k; i++)
	//{
	//	all += p[i];
	//}

	//all = n + (n * n) + (n * n * n);

	/*if (n > 0)
	{
		cout << "a\n";
	}
	else
	{
		cout << "A\n";
	}*/
	//n = t.length();

	/*cout << "AC x " << ac << "\n";
	cout << "WA x " << wa << "\n";
	cout << "TLE x " << tle << "\n";
	cout << "RE x " << re << "\n";*/

	//cout << x << "\n";
	//cout << all << "\n";
	//cout << box << "\n";
	//cout << a << b << c << "\n";

	if (flag == true)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}

	//cout << fixed << setprecision(111) << all;
	//return 0;
}


Measured memory_bytes: 3624