import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
    
		int shakeNum = sc.nextInt();
      
      	int counter = 0;
      
      	String rt = "No";
      
      	for(int i = 0; i < shakeNum; i++) {
        	int num1 = sc.nextInt();
        	int num2 = sc.nextInt();
          
          	if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            }
        }
    	System.out.println(rt);
    }
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
    
		int shakeNum = sc.nextInt();
      
      	int counter = 0;
      
      	String rt = "No";
      
      	for(int i = 0; i < shakeNum; i++) {
        	int num1 = sc.nextInt();
        	int num2 = sc.nextInt();
          
          	if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            }
        }
    	System.out.println(rt);
    }
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
    
		int shakeNum = sc.nextInt();
      
      	int counter = 0;
      
      	String rt = "No";
      
      	for(int i = 0; i < shakeNum; i++) {
        	int num1 = sc.nextInt();
        	int num2 = sc.nextInt();
          
          	if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            }
        }
    	System.out.println(rt);
    } main {
		Scanner sc = new Scanner(System.in);
    
		int shakeNum = sc.nextInt();
      
      	int counter = 0;
      
      	String rt = "No";
      
      	for(int i = 0; i < shakeNum; i++) {
        	int num1 = sc.nextInt();
        	int num2 = sc.nextInt();
          
          	if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            }
        }
    	System.out.println(rt);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int shakeNum = sc.nextInt(); shakeNum sc.nextInt() sc.nextInt sc int counter = 0; counter 0 String rt = "No"; rt "No" for(int i = 0; i < shakeNum; i++) {
        	int num1 = sc.nextInt();
        	int num2 = sc.nextInt();
          
          	if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            }
        } int i = 0; int i = 0; i 0 i < shakeNum i shakeNum i++ i++ i {
        	int num1 = sc.nextInt();
        	int num2 = sc.nextInt();
          
          	if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            }
        } {
        	int num1 = sc.nextInt();
        	int num2 = sc.nextInt();
          
          	if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            }
        } int num1 = sc.nextInt(); num1 sc.nextInt() sc.nextInt sc int num2 = sc.nextInt(); num2 sc.nextInt() sc.nextInt sc if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            } num1 == num2 num1 num2 {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } counter += 1 counter 1 if(counter >= 3) {
                	rt = "Yes";
                  	break;
                } counter >= 3 counter 3 {
                	rt = "Yes";
                  	break;
                } rt = "Yes" rt "Yes" break; {
            	counter = 0;
            } counter = 0 counter 0 System.out.println(rt) System.out.println System.out System System.out rt String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
    
		int shakeNum = sc.nextInt();
      
      	int counter = 0;
      
      	String rt = "No";
      
      	for(int i = 0; i < shakeNum; i++) {
        	int num1 = sc.nextInt();
        	int num2 = sc.nextInt();
          
          	if(num1 == num2) {
            	counter += 1;
              	if(counter >= 3) {
                	rt = "Yes";
                  	break;
                }
            } else {
            	counter = 0;
            }
        }
    	System.out.println(rt);
    }
}