import java.util.*;
import java.io.*;
class Main {
    static boolean isPossible(int[][] a) {
        for(int i = 2; i<a.length; i++) {
            if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true;
        }
        return false;
    }
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] a = new int[n][2];
        for(int i = 0; i<n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }
        if(isPossible(a)) System.out.println("Yes");
        else System.out.println("No");
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    static boolean isPossible(int[][] a) {
        for(int i = 2; i<a.length; i++) {
            if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true;
        }
        return false;
    }
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] a = new int[n][2];
        for(int i = 0; i<n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }
        if(isPossible(a)) System.out.println("Yes");
        else System.out.println("No");
    }
} Main static boolean isPossible(int[][] a) {
        for(int i = 2; i<a.length; i++) {
            if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true;
        }
        return false;
    } isPossible {
        for(int i = 2; i<a.length; i++) {
            if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true;
        }
        return false;
    } for(int i = 2; i<a.length; i++) {
            if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true;
        } int i = 2; int i = 2; i 2 i<a.length i a.length a a.length i++ i++ i {
            if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true;
        } {
            if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true;
        } if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true; a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1] a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1] a[i][0]==a[i][1] a[i][0] a[i] a i 0 a[i][1] a[i] a i 1 a[i-1][0]==a[i-1][1] a[i-1][0] a[i-1] a i-1 i 1 0 a[i-1][1] a[i-1] a i-1 i 1 1 a[i-2][0]==a[i-2][1] a[i-2][0] a[i-2] a i-2 i 2 0 a[i-2][1] a[i-2] a i-2 i 2 1 return true; true return false; false int[][] a a public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] a = new int[n][2];
        for(int i = 0; i<n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }
        if(isPossible(a)) System.out.println("Yes");
        else System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] a = new int[n][2];
        for(int i = 0; i<n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }
        if(isPossible(a)) System.out.println("Yes");
        else 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 int[][] a = new int[n][2]; a new int[n][2] n 2 for(int i = 0; i<n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        } {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        } a[i][0] = sc.nextInt() a[i][0] a[i] a i 0 sc.nextInt() sc.nextInt sc a[i][1] = sc.nextInt() a[i][1] a[i] a i 1 sc.nextInt() sc.nextInt sc if(isPossible(a)) System.out.println("Yes");
        else System.out.println("No"); isPossible(a) isPossible a System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.*;
import java.io.*;
class Main {
    static boolean isPossible(int[][] a) {
        for(int i = 2; i<a.length; i++) {
            if(a[i][0]==a[i][1] && a[i-1][0]==a[i-1][1] && a[i-2][0]==a[i-2][1]) return true;
        }
        return false;
    }
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] a = new int[n][2];
        for(int i = 0; i<n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }
        if(isPossible(a)) System.out.println("Yes");
        else System.out.println("No");
    }
}