#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;

	scanf("%d", &n);

	int cnt = 0;
	for(int i = 0; i < n; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		if(a == b) cnt++;
		else cnt = 0;
		if(cnt >= 3) return printf("Yes\n"), 0;
	}
	printf("No\n");
}
