import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int n = sc.nextInt();
    int count = 0;
    int check = 0;

    for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    }

    for(int i = 0; i < n ; i++){
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    }

    if(check == 0){
        System.out.println("No");
    }else{
        System.out.println("Yes");
    }

    

   

    

    




    







}
} import java.io.BufferedReader; BufferedReader java.io import java.io.*; io.* java import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Collections; Collections java.util import java.util.Arrays; Arrays java.util public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int n = sc.nextInt();
    int count = 0;
    int check = 0;

    for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    }

    for(int i = 0; i < n ; i++){
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    }

    if(check == 0){
        System.out.println("No");
    }else{
        System.out.println("Yes");
    }

    

   

    

    




    







}
} Main public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int n = sc.nextInt();
    int count = 0;
    int check = 0;

    for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    }

    for(int i = 0; i < n ; i++){
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    }

    if(check == 0){
        System.out.println("No");
    }else{
        System.out.println("Yes");
    }

    

   

    

    




    







} main {
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int n = sc.nextInt();
    int count = 0;
    int check = 0;

    for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    }

    for(int i = 0; i < n ; i++){
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    }

    if(check == 0){
        System.out.println("No");
    }else{
        System.out.println("Yes");
    }

    

   

    

    




    







} final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final List<Integer> list = new ArrayList<>(); list new ArrayList<>() final List<Integer> list2 = new ArrayList<>(); list2 new ArrayList<>() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int count = 0; count 0 int check = 0; check 0 for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    } {
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc list2.add(sc.nextInt()) list2.add list2 sc.nextInt() sc.nextInt sc for(int i = 0; i < n ; i++){
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    } {
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    } if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        } list.get(i).equals(list2.get(i)) list.get(i).equals list.get(i) list.get list i list2.get(i) list2.get list2 i {
            count++;
        } count++ count {
            count = 0;
        } count = 0 count 0 if(count == 3){
            check++;
        } count == 3 count 3 {
            check++;
        } check++ check if(check == 0){
        System.out.println("No");
    }else{
        System.out.println("Yes");
    } check == 0 check 0 {
        System.out.println("No");
    } System.out.println("No") System.out.println System.out System System.out "No" {
        System.out.println("Yes");
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" final String[] args args public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int n = sc.nextInt();
    int count = 0;
    int check = 0;

    for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    }

    for(int i = 0; i < n ; i++){
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    }

    if(check == 0){
        System.out.println("No");
    }else{
        System.out.println("Yes");
    }

    

   

    

    




    







}
} public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int n = sc.nextInt();
    int count = 0;
    int check = 0;

    for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    }

    for(int i = 0; i < n ; i++){
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    }

    if(check == 0){
        System.out.println("No");
    }else{
        System.out.println("Yes");
    }

    

   

    

    




    







}
} Main
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int n = sc.nextInt();
    int count = 0;
    int check = 0;

    for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
        list2.add(sc.nextInt());
    }

    for(int i = 0; i < n ; i++){
        if(list.get(i).equals(list2.get(i))){
            count++;
        }else{
            count = 0;
        }
        if(count == 3){
            check++;
        }
    }

    if(check == 0){
        System.out.println("No");
    }else{
        System.out.println("Yes");
    }

    

   

    

    




    







}
}