import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main{
  static String YES = "Yes", NO= "No";
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(), count = 0;
    for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    }
    System.out.println(NO);
  }

  static class Scanner {
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
    }

    public Scanner(FileReader s) throws FileNotFoundException {
      br = new BufferedReader(s);
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    }

    public int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
      return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
      return br.readLine();
    }

    public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }

    public boolean ready() throws IOException {
      return br.ready();
    }
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.io.FileReader; FileReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java public class Main{
  static String YES = "Yes", NO= "No";
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(), count = 0;
    for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    }
    System.out.println(NO);
  }

  static class Scanner {
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
    }

    public Scanner(FileReader s) throws FileNotFoundException {
      br = new BufferedReader(s);
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    }

    public int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
      return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
      return br.readLine();
    }

    public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }

    public boolean ready() throws IOException {
      return br.ready();
    }
  }
} Main static String YES = "Yes" YES "Yes" NO= "No"; NO "No" public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(), count = 0;
    for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    }
    System.out.println(NO);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(), count = 0;
    for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    }
    System.out.println(NO);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt() n sc.nextInt() sc.nextInt sc count = 0; count 0 for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    } {
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    } if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      } sc.nextInt() == sc.nextInt() sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc {
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      } if(++count == 3){
          System.out.println(YES);
          return;
        } ++count == 3 ++count count 3 {
          System.out.println(YES);
          return;
        } System.out.println(YES) System.out.println System.out System System.out YES return; {
        count =0;
      } count =0 count 0 System.out.println(NO) System.out.println System.out System System.out NO String[] args args static class Scanner {
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
    }

    public Scanner(FileReader s) throws FileNotFoundException {
      br = new BufferedReader(s);
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    }

    public int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
      return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
      return br.readLine();
    }

    public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }

    public boolean ready() throws IOException {
      return br.ready();
    }
  } Scanner StringTokenizer st; st BufferedReader br; br public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
    } Scanner {
      br = new BufferedReader(new InputStreamReader(s));
    } br = new BufferedReader(new InputStreamReader(s)) br new BufferedReader(new InputStreamReader(s)) InputStream s s public Scanner(FileReader s) throws FileNotFoundException {
      br = new BufferedReader(s);
    } Scanner {
      br = new BufferedReader(s);
    } br = new BufferedReader(s) br new BufferedReader(s) FileReader s s public String next() throws IOException {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    } next {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    } while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() throws IOException {
      return Integer.parseInt(next());
    } nextInt {
      return Integer.parseInt(next());
    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() throws IOException {
      return Long.parseLong(next());
    } nextLong {
      return Long.parseLong(next());
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public String nextLine() throws IOException {
      return br.readLine();
    } nextLine {
      return br.readLine();
    } return br.readLine(); br.readLine() br.readLine br public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    } nextDouble {
      return Double.parseDouble(next());
    } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public boolean ready() throws IOException {
      return br.ready();
    } ready {
      return br.ready();
    } return br.ready(); br.ready() br.ready br public class Main{
  static String YES = "Yes", NO= "No";
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(), count = 0;
    for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    }
    System.out.println(NO);
  }

  static class Scanner {
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
    }

    public Scanner(FileReader s) throws FileNotFoundException {
      br = new BufferedReader(s);
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    }

    public int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
      return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
      return br.readLine();
    }

    public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }

    public boolean ready() throws IOException {
      return br.ready();
    }
  }
} public class Main{
  static String YES = "Yes", NO= "No";
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(), count = 0;
    for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    }
    System.out.println(NO);
  }

  static class Scanner {
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
    }

    public Scanner(FileReader s) throws FileNotFoundException {
      br = new BufferedReader(s);
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    }

    public int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
      return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
      return br.readLine();
    }

    public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }

    public boolean ready() throws IOException {
      return br.ready();
    }
  }
} Main
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main{
  static String YES = "Yes", NO= "No";
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(), count = 0;
    for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    }
    System.out.println(NO);
  }

  static class Scanner {
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
    }

    public Scanner(FileReader s) throws FileNotFoundException {
      br = new BufferedReader(s);
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    }

    public int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
      return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
      return br.readLine();
    }

    public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }

    public boolean ready() throws IOException {
      return br.ready();
    }
  }
}