import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Stirbul
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(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, FastReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[n];


            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            int count = 0;
            for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            }

            if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}
 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.StringTokenizer; StringTokenizer java.util import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.InputStream; InputStream java.io public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(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, FastReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[n];


            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            int count = 0;
            for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            }

            if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(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;
        FastReader in = new FastReader(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 FastReader in = new FastReader(inputStream); in new FastReader(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, FastReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[n];


            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            int count = 0;
            for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            }

            if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    } BGoToJail public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[n];


            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            int count = 0;
            for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            }

            if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        } solve {
            int n = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[n];


            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            int count = 0;
            for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            }

            if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        } int n = in.nextInt(); n in.nextInt() in.nextInt in int[] a = new int[n]; a new int[n] n int[] b = new int[n]; b new int[n] n for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            } {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            } a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in b[i] = in.nextInt() b[i] b i in.nextInt() in.nextInt in int count = 0; count 0 for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            } {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            } if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                } a[i] == b[i] a[i] a i b[i] b i {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } count++ count if (count == 3) {
                        break;
                    } count == 3 count 3 {
                        break;
                    } break; {
                    count = 0;
                } count = 0 count 0 if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            } count == 3 count 3 {
                out.println("Yes");
            } out.println("Yes") out.println out "Yes" {
                out.println("No");
            } out.println("No") out.println out "No" int testNumber testNumber FastReader in in PrintWriter out out static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    } FastReader BufferedReader br; br StringTokenizer st; st public FastReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        } FastReader {
            br = new BufferedReader(new InputStreamReader(inputStream));
        } br = new BufferedReader(new InputStreamReader(inputStream)) br new BufferedReader(new InputStreamReader(inputStream)) InputStream inputStream inputStream public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    st = new StringTokenizer(br.readLine());
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(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, FastReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[n];


            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            int count = 0;
            for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            }

            if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(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, FastReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[n];


            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            int count = 0;
            for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            }

            if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Stirbul
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(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, FastReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[n];


            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            int count = 0;
            for (int i = 0; i < n; ++i) {
                if (a[i] == b[i]) {
                    count++;
                    if (count == 3) {
                        break;
                    }
                } else {
                    count = 0;
                }
            }

            if (count == 3) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

