import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();

    int cnt = 0;
    boolean judge = false;

    for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    }
    if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();


  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();

    int cnt = 0;
    boolean judge = false;

    for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    }
    if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();


  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();

    int cnt = 0;
    boolean judge = false;

    for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    }
    if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();


  } main {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();

    int cnt = 0;
    boolean judge = false;

    for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    }
    if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();


  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int cnt = 0; cnt 0 boolean judge = false; judge false for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    } {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    } int a1 = sc.nextInt(); a1 sc.nextInt() sc.nextInt sc int a2 = sc.nextInt(); a2 sc.nextInt() sc.nextInt sc if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      } a1 == a2 a1 a2 {
        cnt++; 
      } cnt++ cnt {
        cnt = 0;
      } cnt = 0 cnt 0 if(cnt == 3){
        judge = true;
      } cnt == 3 cnt 3 {
        judge = true;
      } judge = true judge true if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    } judge {
      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" sc.close() sc.close sc String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();

    int cnt = 0;
    boolean judge = false;

    for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    }
    if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();


  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();

    int cnt = 0;
    boolean judge = false;

    for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    }
    if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();


  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();

    int cnt = 0;
    boolean judge = false;

    for (int i = 0; i < num ;i++) {
      int a1 = sc.nextInt();
      int a2 = sc.nextInt();
      if (a1 == a2) {
        cnt++; 
      } else {
        cnt = 0;
      }
      if(cnt == 3){
        judge = true;
      }

    }
    if(judge){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();


  }
}
