import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        boolean[] isZoro = new boolean[n];
        for(int i = 0; i < n; i++){
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        }
        for(int i = 0; i < n - 2; i++){
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

    public static void main(String[] args){
        new Main().solve();
    }
} import java.util.*; util.* java public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        boolean[] isZoro = new boolean[n];
        for(int i = 0; i < n; i++){
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        }
        for(int i = 0; i < n - 2; i++){
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

    public static void main(String[] args){
        new Main().solve();
    }
} Main void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        boolean[] isZoro = new boolean[n];
        for(int i = 0; i < n; i++){
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        }
        for(int i = 0; i < n - 2; i++){
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } solve {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        boolean[] isZoro = new boolean[n];
        for(int i = 0; i < n; i++){
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        }
        for(int i = 0; i < n - 2; i++){
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan boolean[] isZoro = new boolean[n]; isZoro new boolean[n] n for(int i = 0; i < n; i++){
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        } {
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        } if(scan.nextInt() == scan.nextInt()) isZoro[i] = true; scan.nextInt() == scan.nextInt() scan.nextInt() scan.nextInt scan scan.nextInt() scan.nextInt scan isZoro[i] = true isZoro[i] isZoro i true for(int i = 0; i < n - 2; i++){
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i < n - 2 i n - 2 n 2 i++ i++ i {
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        } {
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        } if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            } isZoro[i] && isZoro[i + 1] && isZoro[i + 2] isZoro[i] && isZoro[i + 1] && isZoro[i + 2] isZoro[i] isZoro i isZoro[i + 1] isZoro i + 1 i 1 isZoro[i + 2] isZoro i + 2 i 2 {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" public static void main(String[] args){
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        boolean[] isZoro = new boolean[n];
        for(int i = 0; i < n; i++){
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        }
        for(int i = 0; i < n - 2; i++){
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

    public static void main(String[] args){
        new Main().solve();
    }
} public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        boolean[] isZoro = new boolean[n];
        for(int i = 0; i < n; i++){
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        }
        for(int i = 0; i < n - 2; i++){
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

    public static void main(String[] args){
        new Main().solve();
    }
} Main
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        boolean[] isZoro = new boolean[n];
        for(int i = 0; i < n; i++){
            if(scan.nextInt() == scan.nextInt()) isZoro[i] = true;
        }
        for(int i = 0; i < n - 2; i++){
            if(isZoro[i] && isZoro[i + 1] && isZoro[i + 2]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

    public static void main(String[] args){
        new Main().solve();
    }
}
