import java.util.Scanner;

public class Main {
	// 2-100
	public static String check(int x, int y) {
		
		return "";
	}
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int count = 0;
		int vit = 0;
		while (n-- != 0) {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		}
		if (vit == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

} import java.util.Scanner; Scanner java.util public class Main {
	// 2-100
	public static String check(int x, int y) {
		
		return "";
	}
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int count = 0;
		int vit = 0;
		while (n-- != 0) {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		}
		if (vit == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

} Main // 2-100
	public static String check(int x, int y) {
		
		return "";
	} check {
		
		return "";
	} return ""; "" int x x int y y public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int count = 0;
		int vit = 0;
		while (n-- != 0) {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		}
		if (vit == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int count = 0;
		int vit = 0;
		while (n-- != 0) {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		}
		if (vit == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int count = 0; count 0 int vit = 0; vit 0 while (n-- != 0) {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		} n-- != 0 n-- n 0 {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		} int x = in.nextInt(); x in.nextInt() in.nextInt in int y = in.nextInt(); y in.nextInt() in.nextInt in if (x == y) {
				count++;
			}else {
				count=0;
			} x == y x y {
				count++;
			} count++ count {
				count=0;
			} count=0 count 0 if (count==3) {
				vit = 1;
			} count==3 count 3 {
				vit = 1;
			} vit = 1 vit 1 if (vit == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} vit == 1 vit 1 {
			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" String args[] args public class Main {
	// 2-100
	public static String check(int x, int y) {
		
		return "";
	}
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int count = 0;
		int vit = 0;
		while (n-- != 0) {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		}
		if (vit == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

} public class Main {
	// 2-100
	public static String check(int x, int y) {
		
		return "";
	}
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int count = 0;
		int vit = 0;
		while (n-- != 0) {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		}
		if (vit == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

} Main
import java.util.Scanner;

public class Main {
	// 2-100
	public static String check(int x, int y) {
		
		return "";
	}
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int count = 0;
		int vit = 0;
		while (n-- != 0) {
			int x = in.nextInt();
			int y = in.nextInt();
			
			if (x == y) {
				count++;
			}else {
				count=0;
			}
			if (count==3) {
				vit = 1;
			}
		}
		if (vit == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}