import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final int N = scanner.nextInt();

    boolean[] isZoromeList = new boolean[N];
    for (int i = 0; i < N; i++) {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    }

    boolean is3TimesZorome = false;
    for (int i = 0; i < isZoromeList.length - 2; i++) {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    }

    System.out.println(is3TimesZorome ? "Yes" : "No");
  }
} import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final int N = scanner.nextInt();

    boolean[] isZoromeList = new boolean[N];
    for (int i = 0; i < N; i++) {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    }

    boolean is3TimesZorome = false;
    for (int i = 0; i < isZoromeList.length - 2; i++) {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    }

    System.out.println(is3TimesZorome ? "Yes" : "No");
  }
} Main public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final int N = scanner.nextInt();

    boolean[] isZoromeList = new boolean[N];
    for (int i = 0; i < N; i++) {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    }

    boolean is3TimesZorome = false;
    for (int i = 0; i < isZoromeList.length - 2; i++) {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    }

    System.out.println(is3TimesZorome ? "Yes" : "No");
  } main {
    final Scanner scanner = new Scanner(System.in);
    final int N = scanner.nextInt();

    boolean[] isZoromeList = new boolean[N];
    for (int i = 0; i < N; i++) {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    }

    boolean is3TimesZorome = false;
    for (int i = 0; i < isZoromeList.length - 2; i++) {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    }

    System.out.println(is3TimesZorome ? "Yes" : "No");
  } final Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) final int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner boolean[] isZoromeList = new boolean[N]; isZoromeList new boolean[N] N for (int i = 0; i < N; i++) {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    } {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    } int n1 = scanner.nextInt(); n1 scanner.nextInt() scanner.nextInt scanner int n2 = scanner.nextInt(); n2 scanner.nextInt() scanner.nextInt scanner if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      } n1 == n2 n1 n2 {
        isZoromeList[i] = true;
      } isZoromeList[i] = true isZoromeList[i] isZoromeList i true {
        isZoromeList[i] = false;
      } isZoromeList[i] = false isZoromeList[i] isZoromeList i false boolean is3TimesZorome = false; is3TimesZorome false for (int i = 0; i < isZoromeList.length - 2; i++) {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    } int i = 0; int i = 0; i 0 i < isZoromeList.length - 2 i isZoromeList.length - 2 isZoromeList.length isZoromeList isZoromeList.length 2 i++ i++ i {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    } {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    } if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      } isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2] isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2] isZoromeList[i] isZoromeList i isZoromeList[i + 1] isZoromeList i + 1 i 1 isZoromeList[i + 2] isZoromeList i + 2 i 2 {
        is3TimesZorome = true;
      } is3TimesZorome = true is3TimesZorome true System.out.println(is3TimesZorome ? "Yes" : "No") System.out.println System.out System System.out is3TimesZorome ? "Yes" : "No" is3TimesZorome "Yes" "No" String[] args args public class Main {

  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final int N = scanner.nextInt();

    boolean[] isZoromeList = new boolean[N];
    for (int i = 0; i < N; i++) {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    }

    boolean is3TimesZorome = false;
    for (int i = 0; i < isZoromeList.length - 2; i++) {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    }

    System.out.println(is3TimesZorome ? "Yes" : "No");
  }
} public class Main {

  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final int N = scanner.nextInt();

    boolean[] isZoromeList = new boolean[N];
    for (int i = 0; i < N; i++) {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    }

    boolean is3TimesZorome = false;
    for (int i = 0; i < isZoromeList.length - 2; i++) {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    }

    System.out.println(is3TimesZorome ? "Yes" : "No");
  }
} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final int N = scanner.nextInt();

    boolean[] isZoromeList = new boolean[N];
    for (int i = 0; i < N; i++) {
      int n1 = scanner.nextInt();
      int n2 = scanner.nextInt();

      if (n1 == n2) {
        isZoromeList[i] = true;
      } else {
        isZoromeList[i] = false;
      }
    }

    boolean is3TimesZorome = false;
    for (int i = 0; i < isZoromeList.length - 2; i++) {
      if (isZoromeList[i] && isZoromeList[i + 1] && isZoromeList[i + 2]) {
        is3TimesZorome = true;
      }
    }

    System.out.println(is3TimesZorome ? "Yes" : "No");
  }
}
