#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	string ans = "No";
	int a, b, doublets = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> a >> b;
		if(a!=b)doublets = 0;
		else
		{
			doublets++;
			if(doublets >= 3)
			ans = "Yes";
		}
	}
	cout << ans << '\n';
}