import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int arr[][]=new int[n][n];
     for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        }
    }
    int flag=0;
    for(int i=0;i<=n-3;i++){
        if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    }
   }
    
    if(flag==1)
    System.out.println("Yes");
    else
     System.out.println("No");
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int arr[][]=new int[n][n];
     for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        }
    }
    int flag=0;
    for(int i=0;i<=n-3;i++){
        if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    }
   }
    
    if(flag==1)
    System.out.println("Yes");
    else
     System.out.println("No");
  }
} Main public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int arr[][]=new int[n][n];
     for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        }
    }
    int flag=0;
    for(int i=0;i<=n-3;i++){
        if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    }
   }
    
    if(flag==1)
    System.out.println("Yes");
    else
     System.out.println("No");
  } main {
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int arr[][]=new int[n][n];
     for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        }
    }
    int flag=0;
    for(int i=0;i<=n-3;i++){
        if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    }
   }
    
    if(flag==1)
    System.out.println("Yes");
    else
     System.out.println("No");
  } Scanner s=new Scanner(System.in); s new Scanner(System.in) int n=s.nextInt(); n s.nextInt() s.nextInt s int arr[][]=new int[n][n]; arr new int[n][n] n n for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        }
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
        for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        }
    } {
        for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        }
    } for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        } int j=0; int j=0; j 0 j<2 j 2 j++ j++ j {
          arr[i][j]=s.nextInt();
        } {
          arr[i][j]=s.nextInt();
        } arr[i][j]=s.nextInt() arr[i][j] arr[i] arr i j s.nextInt() s.nextInt s int flag=0; flag 0 for(int i=0;i<=n-3;i++){
        if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    }
   } int i=0; int i=0; i 0 i<=n-3 i n-3 n 3 i++ i++ i {
        if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    }
   } {
        if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    }
   } if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    } arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1] arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1] arr[i][0]==arr[i][1] arr[i][0] arr[i] arr i 0 arr[i][1] arr[i] arr i 1 arr[i+1][0]==arr[i+1][1] arr[i+1][0] arr[i+1] arr i+1 i 1 0 arr[i+1][1] arr[i+1] arr i+1 i 1 1 arr[i+2][0]==arr[i+2][1] arr[i+2][0] arr[i+2] arr i+2 i 2 0 arr[i+2][1] arr[i+2] arr i+2 i 2 1 {
          flag=1;
          break;
    } flag=1 flag 1 break; if(flag==1)
    System.out.println("Yes");
    else
     System.out.println("No"); flag==1 flag 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int arr[][]=new int[n][n];
     for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
          arr[i][j]=s.nextInt();
        }
    }
    int flag=0;
    for(int i=0;i<=n-3;i++){
        if(arr[i][0]==arr[i][1] && arr[i+1][0]==arr[i+1][1] && arr[i+2][0]==arr[i+2][1]){
          flag=1;
          break;
    }
   }
    
    if(flag==1)
    System.out.println("Yes");
    else
     System.out.println("No");
  }
}
