import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

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

        boolean hasNext() throws IOException {
            if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            }
        }
    }

    class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    void run() throws Exception {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int d = 0;
        boolean dd[] = new boolean[3];
        for (int i = 0; i < 3; i++) {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        }
        boolean must = false;
        if (d == 3) {
            must = true;
        }
        for (int i = 0; i < n - 3; i++) {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        }
        if (must) {
            out.print("Yes");
        } else {
            out.print("No");
        }
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }
} import java.io.*; io.* java import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main {
    class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

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

        boolean hasNext() throws IOException {
            if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            }
        }
    }

    class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    void run() throws Exception {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int d = 0;
        boolean dd[] = new boolean[3];
        for (int i = 0; i < 3; i++) {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        }
        boolean must = false;
        if (d == 3) {
            must = true;
        }
        for (int i = 0; i < n - 3; i++) {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        }
        if (must) {
            out.print("Yes");
        } else {
            out.print("No");
        }
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }
} Main void run() throws Exception {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int d = 0;
        boolean dd[] = new boolean[3];
        for (int i = 0; i < 3; i++) {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        }
        boolean must = false;
        if (d == 3) {
            must = true;
        }
        for (int i = 0; i < n - 3; i++) {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        }
        if (must) {
            out.print("Yes");
        } else {
            out.print("No");
        }
        out.close();
    } run {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int d = 0;
        boolean dd[] = new boolean[3];
        for (int i = 0; i < 3; i++) {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        }
        boolean must = false;
        if (d == 3) {
            must = true;
        }
        for (int i = 0; i < n - 3; i++) {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        }
        if (must) {
            out.print("Yes");
        } else {
            out.print("No");
        }
        out.close();
    } Reader in = new Reader(); in new Reader() Writer out = new Writer(); out new Writer() int n = in.nextInt(); n in.nextInt() in.nextInt in int d = 0; d 0 boolean dd[] = new boolean[3]; dd new boolean[3] 3 for (int i = 0; i < 3; i++) {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        } {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        } if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            } in.nextInt() == in.nextInt() in.nextInt() in.nextInt in in.nextInt() in.nextInt in {
                d++;
                dd[i] = true;
            } d++ d dd[i] = true dd[i] dd i true boolean must = false; must false if (d == 3) {
            must = true;
        } d == 3 d 3 {
            must = true;
        } must = true must true for (int i = 0; i < n - 3; i++) {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        } int i = 0; int i = 0; i 0 i < n - 3 i n - 3 n 3 i++ i++ i {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        } {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        } if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            } dd[i % 3] == true dd[i % 3] dd i % 3 i 3 true {
                d--;
                dd[i % 3] = false;
            } d-- d dd[i % 3] = false dd[i % 3] dd i % 3 i 3 false if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            } in.nextInt() == in.nextInt() in.nextInt() in.nextInt in in.nextInt() in.nextInt in {
                d++;
                dd[i % 3] = true;
            } d++ d dd[i % 3] = true dd[i % 3] dd i % 3 i 3 true if (d == 3) {
                must = true;
            } d == 3 d 3 {
                must = true;
            } must = true must true if (must) {
            out.print("Yes");
        } else {
            out.print("No");
        } must {
            out.print("Yes");
        } out.print("Yes") out.print out "Yes" {
            out.print("No");
        } out.print("No") out.print out "No" out.close() out.close out public static void main(String[] args) throws Exception {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

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

        boolean hasNext() throws IOException {
            if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            }
        }
    } Reader BufferedReader in; in StringTokenizer tokin = new StringTokenizer(""); tokin new StringTokenizer("") Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        } Reader {
            in = new BufferedReader(new InputStreamReader(System.in));
        } in = new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        } Reader {
            in = new BufferedReader(new FileReader(name));
        } in = new BufferedReader(new FileReader(name)) in new BufferedReader(new FileReader(name)) String name name String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        } next {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        } if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            } !tokin.hasMoreTokens() tokin.hasMoreTokens() tokin.hasMoreTokens tokin {
                tokin = new StringTokenizer(in.readLine());
            } tokin = new StringTokenizer(in.readLine()) tokin new StringTokenizer(in.readLine()) return tokin.nextToken(); tokin.nextToken() tokin.nextToken tokin int nextInt() throws IOException {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next boolean hasNext() throws IOException {
            if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            }
        } hasNext {
            if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            }
        } if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            } tokin.hasMoreTokens() tokin.hasMoreTokens tokin {
                return true;
            } return true; true {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            } String s = in.readLine(); s in.readLine() in.readLine in while (s != null && s.length() == 0) {
                    s = in.readLine();
                } s != null && s.length() == 0 s != null s null s.length() == 0 s.length() s.length s 0 {
                    s = in.readLine();
                } s = in.readLine() s in.readLine() in.readLine in if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                } s == null s null {
                    return false;
                } return false; false {
                    tokin = new StringTokenizer(s);
                    return true;
                } tokin = new StringTokenizer(s) tokin new StringTokenizer(s) return true; true class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    } Writer PrintWriter cout; cout StringBuilder out = new StringBuilder(); out new StringBuilder() Writer() throws IOException {
            cout = new PrintWriter(System.out);
        } Writer {
            cout = new PrintWriter(System.out);
        } cout = new PrintWriter(System.out) cout new PrintWriter(System.out) Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        } Writer {
            cout = new PrintWriter(new FileWriter(name));
        } cout = new PrintWriter(new FileWriter(name)) cout new PrintWriter(new FileWriter(name)) String name name void print(Object a) {
            out.append(a);
        } print {
            out.append(a);
        } out.append(a) out.append out a Object a a void close() {
            cout.print(out.toString());
            cout.close();
        } close {
            cout.print(out.toString());
            cout.close();
        } cout.print(out.toString()) cout.print cout out.toString() out.toString out cout.close() cout.close cout public class Main {
    class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

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

        boolean hasNext() throws IOException {
            if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            }
        }
    }

    class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    void run() throws Exception {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int d = 0;
        boolean dd[] = new boolean[3];
        for (int i = 0; i < 3; i++) {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        }
        boolean must = false;
        if (d == 3) {
            must = true;
        }
        for (int i = 0; i < n - 3; i++) {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        }
        if (must) {
            out.print("Yes");
        } else {
            out.print("No");
        }
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }
} public class Main {
    class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

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

        boolean hasNext() throws IOException {
            if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            }
        }
    }

    class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    void run() throws Exception {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int d = 0;
        boolean dd[] = new boolean[3];
        for (int i = 0; i < 3; i++) {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        }
        boolean must = false;
        if (d == 3) {
            must = true;
        }
        for (int i = 0; i < n - 3; i++) {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        }
        if (must) {
            out.print("Yes");
        } else {
            out.print("No");
        }
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }
} Main
import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

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

        boolean hasNext() throws IOException {
            if (tokin.hasMoreTokens()) {
                return true;
            } else {
                String s = in.readLine();
                while (s != null && s.length() == 0) {
                    s = in.readLine();
                }
                if (s == null) {
                    return false;
                } else {
                    tokin = new StringTokenizer(s);
                    return true;
                }
            }
        }
    }

    class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    void run() throws Exception {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int d = 0;
        boolean dd[] = new boolean[3];
        for (int i = 0; i < 3; i++) {
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i] = true;
            }
        }
        boolean must = false;
        if (d == 3) {
            must = true;
        }
        for (int i = 0; i < n - 3; i++) {
            if (dd[i % 3] == true) {
                d--;
                dd[i % 3] = false;
            }
            if (in.nextInt() == in.nextInt()) {
                d++;
                dd[i % 3] = true;
            }
            if (d == 3) {
                must = true;
            }
        }
        if (must) {
            out.print("Yes");
        } else {
            out.print("No");
        }
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }
}
