
import java.util.Scanner;

/**
 * Created by enpingkuang on 2020/9/19 7:53 下午
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ans = 0;
        int tmp = 0;
        for(int i = 0;i<n;i++){
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        }
        if(ans >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ans = 0;
        int tmp = 0;
        for(int i = 0;i<n;i++){
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        }
        if(ans >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ans = 0;
        int tmp = 0;
        for(int i = 0;i<n;i++){
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        }
        if(ans >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ans = 0;
        int tmp = 0;
        for(int i = 0;i<n;i++){
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        }
        if(ans >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int ans = 0; ans 0 int tmp = 0; tmp 0 for(int i = 0;i<n;i++){
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        } {
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        } int x x y; y x = scanner.nextInt() x scanner.nextInt() scanner.nextInt scanner y = scanner.nextInt() y scanner.nextInt() scanner.nextInt scanner if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            } x == y x y {
                tmp++;
                ans = Math.max(ans,tmp);
            } tmp++ tmp ans = Math.max(ans,tmp) ans Math.max(ans,tmp) Math.max Math ans tmp {
                tmp = 0;
            } tmp = 0 tmp 0 if(ans >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } ans >= 3 ans 3 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ans = 0;
        int tmp = 0;
        for(int i = 0;i<n;i++){
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        }
        if(ans >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ans = 0;
        int tmp = 0;
        for(int i = 0;i<n;i++){
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        }
        if(ans >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main

import java.util.Scanner;

/**
 * Created by enpingkuang on 2020/9/19 7:53 下午
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ans = 0;
        int tmp = 0;
        for(int i = 0;i<n;i++){
            int x,y;
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == y){
                tmp++;
                ans = Math.max(ans,tmp);
            }else{
                tmp = 0;
            }
        }
        if(ans >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
