import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int streak = 0;
        for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int streak = 0;
        for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    }
} Main public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int streak = 0;
        for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    } main {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int streak = 0;
        for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int streak = 0; streak 0 for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        } {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        } int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner if (a == b) {
                streak++;
            } else {
                streak = 0;
            } a == b a b {
                streak++;
            } streak++ streak {
                streak = 0;
            } streak = 0 streak 0 if (streak == 3) {
                System.out.println("Yes");
                return;
            } streak == 3 streak 3 {
                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" String... args args public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int streak = 0;
        for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    }
} public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int streak = 0;
        for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int streak = 0;
        for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            if (a == b) {
                streak++;
            } else {
                streak = 0;
            }

            if (streak == 3) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    }
}