import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),f=0;
    int[] d1=new int[n],d2=new int[n];
    for(int i=0;i<n;i++){
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    }
    if(f<3){
      System.out.println("No");
    }
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),f=0;
    int[] d1=new int[n],d2=new int[n];
    for(int i=0;i<n;i++){
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    }
    if(f<3){
      System.out.println("No");
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),f=0;
    int[] d1=new int[n],d2=new int[n];
    for(int i=0;i<n;i++){
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    }
    if(f<3){
      System.out.println("No");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),f=0;
    int[] d1=new int[n],d2=new int[n];
    for(int i=0;i<n;i++){
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    }
    if(f<3){
      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 f=0; f 0 int[] d1=new int[n] d1 new int[n] n d2=new int[n]; d2 new int[n] n for(int i=0;i<n;i++){
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    } {
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    } d1[i]=sc.nextInt() d1[i] d1 i sc.nextInt() sc.nextInt sc d2[i]=sc.nextInt() d2[i] d2 i sc.nextInt() sc.nextInt sc if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      } d1[i]==d2[i] d1[i] d1 i d2[i] d2 i {
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      } f++ f if(f==3){
          System.out.println("Yes");
          break;
        } f==3 f 3 {
          System.out.println("Yes");
          break;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" break; {
        f=0;
      } f=0 f 0 if(f<3){
      System.out.println("No");
    } f<3 f 3 {
      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){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),f=0;
    int[] d1=new int[n],d2=new int[n];
    for(int i=0;i<n;i++){
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    }
    if(f<3){
      System.out.println("No");
    }
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),f=0;
    int[] d1=new int[n],d2=new int[n];
    for(int i=0;i<n;i++){
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    }
    if(f<3){
      System.out.println("No");
    }
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),f=0;
    int[] d1=new int[n],d2=new int[n];
    for(int i=0;i<n;i++){
      d1[i]=sc.nextInt();
      d2[i]=sc.nextInt();
      if(d1[i]==d2[i]){
        f++;
        if(f==3){
          System.out.println("Yes");
          break;
        }
      }else{
        f=0;
      }
    }
    if(f<3){
      System.out.println("No");
    }
  }
}