import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int best = 0;
		int ren = 0;
		for (int i = 0; i < n; i++) {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		}

		System.out.println(best >= 3 ? "Yes" : "No");
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int best = 0;
		int ren = 0;
		for (int i = 0; i < n; i++) {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		}

		System.out.println(best >= 3 ? "Yes" : "No");
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int best = 0;
		int ren = 0;
		for (int i = 0; i < n; i++) {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		}

		System.out.println(best >= 3 ? "Yes" : "No");
	} main {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int best = 0;
		int ren = 0;
		for (int i = 0; i < n; i++) {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		}

		System.out.println(best >= 3 ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int best = 0; best 0 int ren = 0; ren 0 for (int i = 0; i < n; i++) {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		} {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		} long a = Long.parseLong(sc.next()); a Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc long b = Long.parseLong(sc.next()); b Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc ren = (a == b) ? (ren + 1) : (0) ren (a == b) ? (ren + 1) : (0) (a == b) a b (ren + 1) ren 1 (0) if (best <= ren) {
				best = ren;
			} best <= ren best ren {
				best = ren;
			} best = ren best ren System.out.println(best >= 3 ? "Yes" : "No") System.out.println System.out System System.out best >= 3 ? "Yes" : "No" best >= 3 best 3 "Yes" "No" String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int best = 0;
		int ren = 0;
		for (int i = 0; i < n; i++) {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		}

		System.out.println(best >= 3 ? "Yes" : "No");
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int best = 0;
		int ren = 0;
		for (int i = 0; i < n; i++) {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		}

		System.out.println(best >= 3 ? "Yes" : "No");
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int best = 0;
		int ren = 0;
		for (int i = 0; i < n; i++) {
			long a = Long.parseLong(sc.next());
			long b = Long.parseLong(sc.next());
			ren = (a == b) ? (ren + 1) : (0);

			if (best <= ren) {
				best = ren;
			}
		}

		System.out.println(best >= 3 ? "Yes" : "No");
	}
}