import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ans = "No";
    int n = sc.nextInt();
    int zoro = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    }
    System.out.println(ans);
    sc.close();
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ans = "No";
    int n = sc.nextInt();
    int zoro = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    }
    System.out.println(ans);
    sc.close();
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ans = "No";
    int n = sc.nextInt();
    int zoro = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    }
    System.out.println(ans);
    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);
    String ans = "No";
    int n = sc.nextInt();
    int zoro = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    }
    System.out.println(ans);
    sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String ans = "No"; ans "No" int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int zoro = 0; zoro 0 for (int cnt = 0; cnt < n; cnt++) {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    } int cnt = 0; int cnt = 0; cnt 0 cnt < n cnt n cnt++ cnt++ cnt {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    } {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    } int d1 = sc.nextInt(); d1 sc.nextInt() sc.nextInt sc int d2 = sc.nextInt(); d2 sc.nextInt() sc.nextInt sc if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      } d1 == d2 d1 d2 {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } zoro++ zoro if (zoro == 3) {
          ans = "Yes";
        } zoro == 3 zoro 3 {
          ans = "Yes";
        } ans = "Yes" ans "Yes" {
        zoro = 0;
      } zoro = 0 zoro 0 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ans = "No";
    int n = sc.nextInt();
    int zoro = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    }
    System.out.println(ans);
    sc.close();
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ans = "No";
    int n = sc.nextInt();
    int zoro = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    }
    System.out.println(ans);
    sc.close();
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ans = "No";
    int n = sc.nextInt();
    int zoro = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      int d1 = sc.nextInt();
      int d2 = sc.nextInt();
      if (d1 == d2) {
        zoro++;
        if (zoro == 3) {
          ans = "Yes";
        }
      } else {
        zoro = 0;
      }
    }
    System.out.println(ans);
    sc.close();
  }
}
