import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        // スペース区切りの整数の入力
        
        
        int[] a = new int[N];
        int[] b = new int[N];
        
        int z;
        z=0;

        for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        }
        
        for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        }        
        
        if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        }
        
        
    }
} 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[] a = new int[N];
        int[] b = new int[N];
        
        int z;
        z=0;

        for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        }
        
        for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        }        
        
        if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        }
        
        
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        // スペース区切りの整数の入力
        
        
        int[] a = new int[N];
        int[] b = new int[N];
        
        int z;
        z=0;

        for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        }
        
        for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        }        
        
        if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        }
        
        
    } main {
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        // スペース区切りの整数の入力
        
        
        int[] a = new int[N];
        int[] b = new int[N];
        
        int z;
        z=0;

        for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        }
        
        for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        }        
        
        if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        }
        
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] a = new int[N]; a new int[N] N int[] b = new int[N]; b new int[N] N int z; z z=0 z 0 for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        } {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        } a[i]=sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc b[i]=sc.nextInt() b[i] b i sc.nextInt() sc.nextInt sc for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        } int j=0; int j=0; j 0 j<N-2 j N-2 N 2 j++ j++ j {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        } {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        } if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	} a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2] a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2] a[j]==b[j] a[j] a j b[j] b j a[j+1]==b[j+1] a[j+1] a j+1 j 1 b[j+1] b j+1 j 1 a[j+2]==b[j+2] a[j+2] a j+2 j 2 b[j+2] b j+2 j 2 {
        		z=z+1;
        	} z=z+1 z z+1 z 1 {
        		z=z+0;
        	} z=z+0 z z+0 z 0 if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        } z==0 z 0 {
        	System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" {
        	System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        // スペース区切りの整数の入力
        
        
        int[] a = new int[N];
        int[] b = new int[N];
        
        int z;
        z=0;

        for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        }
        
        for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        }        
        
        if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        }
        
        
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        // スペース区切りの整数の入力
        
        
        int[] a = new int[N];
        int[] b = new int[N];
        
        int z;
        z=0;

        for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        }
        
        for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        }        
        
        if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        }
        
        
    }
} 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[] a = new int[N];
        int[] b = new int[N];
        
        int z;
        z=0;

        for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        }
        
        for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        }        
        
        if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        }
        
        
    }
}