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

int n,ans;
int d[105];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		if(x==y) d[i]=1;
		if(i>=3&&d[i]&&d[i-1]&&d[i-2]) ans=1;
	}
	if(ans) puts("Yes");
	else puts("No");
	return 0;
}