#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	int a,b,count=0;
	string s;
	s="No";
	for(int i=0;i<n;i++)
	{
	    cin>>a>>b;
	    if(a==b)
	    count++;
	    else
	    count=0;
	    if(count==3)
	    s="Yes";
	}
	cout<<s;
	return 0;
}