import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        final long MOD = (long)Math.pow(10,9)+7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        String ans = "No";
        for (int i = 0;i<n;++i)
        {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
        sc.close();
//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
} import java.util.*; util.* java public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        final long MOD = (long)Math.pow(10,9)+7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        String ans = "No";
        for (int i = 0;i<n;++i)
        {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
        sc.close();
//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
} Main public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        final long MOD = (long)Math.pow(10,9)+7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        String ans = "No";
        for (int i = 0;i<n;++i)
        {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
        sc.close();
//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    } main {
        //long start = System.currentTimeMillis();
        final long MOD = (long)Math.pow(10,9)+7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        String ans = "No";
        for (int i = 0;i<n;++i)
        {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
        sc.close();
//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    } final long MOD = (long)Math.pow(10,9)+7; MOD (long)Math.pow(10,9)+7 (long)Math.pow(10,9) Math.pow Math 10 9 7 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int count = 0; count 0 String ans = "No"; ans "No" for (int i = 0;i<n;++i)
        {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        } 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) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        } {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if (a == b) ++count;
            else count = 0; a == b a b ++count count count = 0 count 0 if (count >= 3)
            {
                ans = "Yes";
                break;
            } count >= 3 count 3 {
                ans = "Yes";
                break;
            } ans = "Yes" ans "Yes" break; System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        final long MOD = (long)Math.pow(10,9)+7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        String ans = "No";
        for (int i = 0;i<n;++i)
        {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
        sc.close();
//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
} public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        final long MOD = (long)Math.pow(10,9)+7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        String ans = "No";
        for (int i = 0;i<n;++i)
        {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
        sc.close();
//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
} Main
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        final long MOD = (long)Math.pow(10,9)+7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        String ans = "No";
        for (int i = 0;i<n;++i)
        {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a == b) ++count;
            else count = 0;

            if (count >= 3)
            {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
        sc.close();
//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
}