import std.container;
import std.range;
import std.algorithm;
import std.array;
import std.string;
import std.conv;
import std.stdio;
import std.container;

void main() {
	long n = readln.chomp.to!int;

	auto d = new bool[n];
	
	foreach (i;0..n) {
		int a, b;
		readf("%s %s\n", a, b);

		d[i] = a == b;
	}

	if (n < 3) {
		writeln("No");
		return;
	}
	
	foreach (i;2..n) {
		if (d[i - 2] && d[i - 1] && d[i]) {
			writeln("Yes");
			return;
		}
	}
	writeln("No");
}
