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");
  }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz