import java.util.*;

public class Main {

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

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

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

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

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            b[i] = scan.nextInt();
        }
        boolean ans = false;
        for (int i = 0; i + 2 < n; i++) {
            if (a[i] == b[i] && a[i + 1] == b[i + 1] && a[i + 2] == b[i + 2]) ans = true;
        }
        System.out.println(ans ? "Yes" : "No");
    }
}
