import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		boolean can = false;
		for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		boolean can = false;
		for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		boolean can = false;
		for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		boolean can = false;
		for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int max = 0; max 0 boolean can = false; can false for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		} {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		} int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc if (d == e) {
				max++;
			} else {
				max = 0;
			} d == e d e {
				max++;
			} max++ max {
				max = 0;
			} max = 0 max 0 if (max == 3) can = true; max == 3 max 3 can = true can true if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} can {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		boolean can = false;
		for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		boolean can = false;
		for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		boolean can = false;
		for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			int e = sc.nextInt();
			if (d == e) {
				max++;
			} else {
				max = 0;
			}
			if (max == 3) can = true;
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	}
}
