#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	int cnt;bool flag=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		if(x==y){
			cnt++;
			if(cnt==3) flag = 1;
	    }
		else cnt=0;
	}
	if(flag)cout<<"Yes";else cout<<"No";
	return 0;
}