import java.util.Scanner;

public class Main {

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

        int N = Integer.parseInt(in.nextLine());
        int countDoublets = 0;
        boolean threeConsecutive = false;
        for (int i = 0 ; !threeConsecutive && i < N; i++) {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        }

        if (!threeConsecutive)
            System.out.println("No");

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

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

        int N = Integer.parseInt(in.nextLine());
        int countDoublets = 0;
        boolean threeConsecutive = false;
        for (int i = 0 ; !threeConsecutive && i < N; i++) {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        }

        if (!threeConsecutive)
            System.out.println("No");

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

        int N = Integer.parseInt(in.nextLine());
        int countDoublets = 0;
        boolean threeConsecutive = false;
        for (int i = 0 ; !threeConsecutive && i < N; i++) {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        }

        if (!threeConsecutive)
            System.out.println("No");

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

        int N = Integer.parseInt(in.nextLine());
        int countDoublets = 0;
        boolean threeConsecutive = false;
        for (int i = 0 ; !threeConsecutive && i < N; i++) {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        }

        if (!threeConsecutive)
            System.out.println("No");

    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = Integer.parseInt(in.nextLine()); N Integer.parseInt(in.nextLine()) Integer.parseInt Integer in.nextLine() in.nextLine in int countDoublets = 0; countDoublets 0 boolean threeConsecutive = false; threeConsecutive false for (int i = 0 ; !threeConsecutive && i < N; i++) {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        } int i = 0 ; int i = 0 ; i 0 !threeConsecutive && i < N !threeConsecutive threeConsecutive i < N i N i++ i++ i {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        } {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        } String[] read = in.nextLine().split(" "); read in.nextLine().split(" ") in.nextLine().split in.nextLine() in.nextLine in " " int d1 = Integer.parseInt(read[0]) d1 Integer.parseInt(read[0]) Integer.parseInt Integer read[0] read 0 d2 = Integer.parseInt(read[1]); d2 Integer.parseInt(read[1]) Integer.parseInt Integer read[1] read 1 if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            } d1 == d2 d1 d2 {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } countDoublets++ countDoublets if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                } countDoublets == 3 countDoublets 3 {
                    System.out.println("Yes");
                    threeConsecutive = true;
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" threeConsecutive = true threeConsecutive true {
                countDoublets = 0;
            } countDoublets = 0 countDoublets 0 if (!threeConsecutive)
            System.out.println("No"); !threeConsecutive threeConsecutive 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 in = new Scanner(System.in);

        int N = Integer.parseInt(in.nextLine());
        int countDoublets = 0;
        boolean threeConsecutive = false;
        for (int i = 0 ; !threeConsecutive && i < N; i++) {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        }

        if (!threeConsecutive)
            System.out.println("No");

    }
} public class Main {

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

        int N = Integer.parseInt(in.nextLine());
        int countDoublets = 0;
        boolean threeConsecutive = false;
        for (int i = 0 ; !threeConsecutive && i < N; i++) {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        }

        if (!threeConsecutive)
            System.out.println("No");

    }
} Main
import java.util.Scanner;

public class Main {

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

        int N = Integer.parseInt(in.nextLine());
        int countDoublets = 0;
        boolean threeConsecutive = false;
        for (int i = 0 ; !threeConsecutive && i < N; i++) {
            String[] read = in.nextLine().split(" ");
            int d1 = Integer.parseInt(read[0]), d2 = Integer.parseInt(read[1]);
            if (d1 == d2) {
                countDoublets++;
                if (countDoublets == 3) {
                    System.out.println("Yes");
                    threeConsecutive = true;
                }
            } else {
                countDoublets = 0;
            }
        }

        if (!threeConsecutive)
            System.out.println("No");

    }
}

