import java.util.Scanner;

public class Main {
  static Scanner in = new Scanner(System.in);
  static int[] a;
  static int[] b;
  static int n;
  public static void main(String[] args) {
    n = in.nextInt();
    a = new int[n];
    b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    }
    System.out.println(check());
  }
  static String check() {
    for (int i = 0; i + 2 < n; i++) {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    }
    return  "No";
  }
} import java.util.Scanner; Scanner java.util public class Main {
  static Scanner in = new Scanner(System.in);
  static int[] a;
  static int[] b;
  static int n;
  public static void main(String[] args) {
    n = in.nextInt();
    a = new int[n];
    b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    }
    System.out.println(check());
  }
  static String check() {
    for (int i = 0; i + 2 < n; i++) {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    }
    return  "No";
  }
} Main static Scanner in = new Scanner(System.in); in new Scanner(System.in) static int[] a; a static int[] b; b static int n; n public static void main(String[] args) {
    n = in.nextInt();
    a = new int[n];
    b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    }
    System.out.println(check());
  } main {
    n = in.nextInt();
    a = new int[n];
    b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    }
    System.out.println(check());
  } n = in.nextInt() n in.nextInt() in.nextInt in a = new int[n] a new int[n] n b = new int[n] b new int[n] n for (int i = 0; i < n; i++) {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    } {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    } a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in b[i] = in.nextInt() b[i] b i in.nextInt() in.nextInt in System.out.println(check()) System.out.println System.out System System.out check() check String[] args args static String check() {
    for (int i = 0; i + 2 < n; i++) {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    }
    return  "No";
  } check {
    for (int i = 0; i + 2 < n; i++) {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    }
    return  "No";
  } for (int i = 0; i + 2 < n; i++) {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    } int i = 0; int i = 0; i 0 i + 2 < n i + 2 i 2 n i++ i++ i {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    } {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    } if (a[i] != b[i]) {
        continue;
      } a[i] != b[i] a[i] a i b[i] b i {
        continue;
      } continue; if (a[i + 1] != b[i + 1]) {
        continue;
      } a[i + 1] != b[i + 1] a[i + 1] a i + 1 i 1 b[i + 1] b i + 1 i 1 {
        continue;
      } continue; if (a[i + 2] != b[i + 2]) {
        continue;
      } a[i + 2] != b[i + 2] a[i + 2] a i + 2 i 2 b[i + 2] b i + 2 i 2 {
        continue;
      } continue; return "Yes"; "Yes" return  "No"; "No" public class Main {
  static Scanner in = new Scanner(System.in);
  static int[] a;
  static int[] b;
  static int n;
  public static void main(String[] args) {
    n = in.nextInt();
    a = new int[n];
    b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    }
    System.out.println(check());
  }
  static String check() {
    for (int i = 0; i + 2 < n; i++) {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    }
    return  "No";
  }
} public class Main {
  static Scanner in = new Scanner(System.in);
  static int[] a;
  static int[] b;
  static int n;
  public static void main(String[] args) {
    n = in.nextInt();
    a = new int[n];
    b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    }
    System.out.println(check());
  }
  static String check() {
    for (int i = 0; i + 2 < n; i++) {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    }
    return  "No";
  }
} Main
import java.util.Scanner;

public class Main {
  static Scanner in = new Scanner(System.in);
  static int[] a;
  static int[] b;
  static int n;
  public static void main(String[] args) {
    n = in.nextInt();
    a = new int[n];
    b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = in.nextInt();
      b[i] = in.nextInt();
    }
    System.out.println(check());
  }
  static String check() {
    for (int i = 0; i + 2 < n; i++) {
      if (a[i] != b[i]) {
        continue;
      }
      if (a[i + 1] != b[i + 1]) {
        continue;
      }
      if (a[i + 2] != b[i + 2]) {
        continue;
      }
      return "Yes";
    }
    return  "No";
  }
}
