import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;

        for (int i = 0; i < n; i++) {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");

        sc.close();

        }

    }
 import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;

        for (int i = 0; i < n; i++) {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");

        sc.close();

        }

    } Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;

        for (int i = 0; i < n; i++) {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");

        sc.close();

        } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;

        for (int i = 0; i < n; i++) {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");

        sc.close();

        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int cnt = 0; cnt 0 for (int i = 0; i < n; i++) {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        } {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        } int a  = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b  = sc.nextInt(); b sc.nextInt() sc.nextInt sc if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            } a == b a b {
                cnt++;
            } cnt++ cnt {
                cnt = 0;
            } cnt = 0 cnt 0 if (cnt > 2) {
                System.out.println("Yes");
                return;
            } cnt > 2 cnt 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" sc.close() sc.close sc String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;

        for (int i = 0; i < n; i++) {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");

        sc.close();

        }

    } public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;

        for (int i = 0; i < n; i++) {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");

        sc.close();

        }

    } Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;

        for (int i = 0; i < n; i++) {
            int a  = sc.nextInt();
            int b  = sc.nextInt();

            if (a == b) {
                cnt++;
            } else {
                cnt = 0;
            }
            if (cnt > 2) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");

        sc.close();

        }

    }

