import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        }
    }

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

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        }
    }

} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        }
    } main {
        try (Scanner sc = new Scanner(System.in)) {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        }
    } try (Scanner sc = new Scanner(System.in)) {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        } {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int count = 0; count 0 String result = "No"; result "No" for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            } {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            } int d1 = Integer.parseInt(sc.next()); d1 Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int d2 = Integer.parseInt(sc.next()); d2 Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                } d1 == d2 d1 d2 {
                    count++;
                } count++ count {
                    count = 0;
                } count = 0 count 0 if (count == 3) {
                    result = "Yes";
                    break;
                } count == 3 count 3 {
                    result = "Yes";
                    break;
                } result = "Yes" result "Yes" break; System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        }
    }

} public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        }
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = Integer.parseInt(sc.next());
            int count = 0; String result = "No";
            for (int i = 0; i < N; i++) {
                int d1 = Integer.parseInt(sc.next());
                int d2 = Integer.parseInt(sc.next());
                if (d1 == d2) {
                    count++;
                } else {
                    count = 0;
                }
                if (count == 3) {
                    result = "Yes";
                    break;
                }
            }
            System.out.println(result);
        }
    }

}