import java.util.*;

public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] a = new int[110][5];
        
        for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        boolean ans = false;
                
        for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        }
        
        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] a = new int[110][5];
        
        for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        boolean ans = false;
                
        for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        }
        
        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] a = new int[110][5];
        
        for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        boolean ans = false;
                
        for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        }
        
        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] a = new int[110][5];
        
        for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        boolean ans = false;
                
        for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        }
        
        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } 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[110][5]; a new int[110][5] 110 5 for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        } int i = 0 ; int i = 0 ; i 0 sc.hasNext() sc.hasNext sc i++ i++ i {
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        } {
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        } for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            } int j = 0 ; int j = 0 ; j 0 j < 2 j 2 j++ j++ j {
                a[i][j] = sc.nextInt();
            } {
                a[i][j] = sc.nextInt();
            } a[i][j] = sc.nextInt() a[i][j] a[i] a i j sc.nextInt() sc.nextInt sc int count = 0; count 0 boolean ans = false; ans false for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        } int i = 0 ; int i = 0 ; i 0 i < N i N i++ i++ i {
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        } {
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        } if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            } (a[i][0] == a[i][1]) a[i][0] a[i] a i 0 a[i][1] a[i] a i 1 {
                count++;
                if(count >= 3){
                    ans = true;
                }
            } count++ count if(count >= 3){
                    ans = true;
                } count >= 3 count 3 {
                    ans = true;
                } ans = true ans true {
                count = 0;
            } count = 0 count 0 if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } ans {
            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 {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] a = new int[110][5];
        
        for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        boolean ans = false;
                
        for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        }
        
        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] a = new int[110][5];
        
        for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        boolean ans = false;
                
        for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        }
        
        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] a = new int[110][5];
        
        for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        boolean ans = false;
                
        for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        }
        
        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
