import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int c=0;
    int flg=0;
    while(n-->0){
      int x = sc.nextInt();
      int y = sc.nextInt();
      
      if(x==y){
        c++;
        if(c>=3){
        flg=1;
      }
      }
      else{
        c=0;
      }
    }
    if(flg==0){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int c=0;
    int flg=0;
    while(n-->0){
      int x = sc.nextInt();
      int y = sc.nextInt();
      
      if(x==y){
        c++;
        if(c>=3){
        flg=1;
      }
      }
      else{
        c=0;
      }
    }
    if(flg==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 c=0;
    int flg=0;
    while(n-->0){
      int x = sc.nextInt();
      int y = sc.nextInt();
      
      if(x==y){
        c++;
        if(c>=3){
        flg=1;
      }
      }
      else{
        c=0;
      }
    }
    if(flg==0){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int c=0;
    int flg=0;
    while(n-->0){
      int x = sc.nextInt();
      int y = sc.nextInt();
      
      if(x==y){
        c++;
        if(c>=3){
        flg=1;
      }
      }
      else{
        c=0;
      }
    }
    if(flg==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 c=0; c 0 int flg=0; flg 0 while(n-->0){
      int x = sc.nextInt();
      int y = sc.nextInt();
      
      if(x==y){
        c++;
        if(c>=3){
        flg=1;
      }
      }
      else{
        c=0;
      }
    } n-->0 n-- n 0 {
      int x = sc.nextInt();
      int y = sc.nextInt();
      
      if(x==y){
        c++;
        if(c>=3){
        flg=1;
      }
      }
      else{
        c=0;
      }
    } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc if(x==y){
        c++;
        if(c>=3){
        flg=1;
      }
      }
      else{
        c=0;
      } x==y x y {
        c++;
        if(c>=3){
        flg=1;
      }
      } c++ c if(c>=3){
        flg=1;
      } c>=3 c 3 {
        flg=1;
      } flg=1 flg 1 {
        c=0;
      } c=0 c 0 if(flg==0){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    } flg==0 flg 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
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int c=0;
    int flg=0;
    while(n-->0){
      int x = sc.nextInt();
      int y = sc.nextInt();
      
      if(x==y){
        c++;
        if(c>=3){
        flg=1;
      }
      }
      else{
        c=0;
      }
    }
    if(flg==0){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }
  }
}