#include <bits/stdc++.h>
using namespace std;
int main(){
	int n ;
	cin >> n ;
	int a,b,c=0;
	while(n--){
		cin >> a >> b ;
		c=(a==b)?c+1:0;
		if(c==3){
				cout << "Yes" << endl;
				return 0;
		}
	}
	cout << "No" << endl ;
}
