import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGoToJail solver = new BGoToJail();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGoToJail {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] d1 = new int[n];
            int[] d2 = new int[n];
            for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
            return;

        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGoToJail solver = new BGoToJail();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGoToJail {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] d1 = new int[n];
            int[] d2 = new int[n];
            for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
            return;

        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGoToJail solver = new BGoToJail();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGoToJail solver = new BGoToJail();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) BGoToJail solver = new BGoToJail(); solver new BGoToJail() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class BGoToJail {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] d1 = new int[n];
            int[] d2 = new int[n];
            for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
            return;

        }

    } BGoToJail public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] d1 = new int[n];
            int[] d2 = new int[n];
            for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
            return;

        } solve {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] d1 = new int[n];
            int[] d2 = new int[n];
            for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
            return;

        } int n = Integer.parseInt(in.next()); n Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int[] d1 = new int[n]; d1 new int[n] n int[] d2 = new int[n]; d2 new int[n] n for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            } {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            } d1[i] = Integer.parseInt(in.next()) d1[i] d1 i Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in d2[i] = Integer.parseInt(in.next()) d2[i] d2 i Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            } int i = 0; int i = 0; i 0 i < n - 2 i n - 2 n 2 i++ i++ i {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            } {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            } if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                } d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2] d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2] d1[i] == d2[i] d1[i] d1 i d2[i] d2 i d1[i + 1] == d2[i + 1] d1[i + 1] d1 i + 1 i 1 d2[i + 1] d2 i + 1 i 1 d1[i + 2] == d2[i + 2] d1[i + 2] d1 i + 2 i 2 d2[i + 2] d2 i + 2 i 2 {
                    out.println("Yes");
                    return;
                } out.println("Yes") out.println out "Yes" return; out.println("No") out.println out "No" return; int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGoToJail solver = new BGoToJail();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGoToJail {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] d1 = new int[n];
            int[] d2 = new int[n];
            for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
            return;

        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGoToJail solver = new BGoToJail();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGoToJail {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] d1 = new int[n];
            int[] d2 = new int[n];
            for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
            return;

        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGoToJail solver = new BGoToJail();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGoToJail {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] d1 = new int[n];
            int[] d2 = new int[n];
            for (int i = 0; i < n; i++) {
                d1[i] = Integer.parseInt(in.next());
                d2[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n - 2; i++) {
                if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
            return;

        }

    }
}

