import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        }

        boolean isAns = false;
        for (int i = 0; i < n-2; i++) {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        }

        System.out.println(isAns ? "Yes" : "No");
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        }

        boolean isAns = false;
        for (int i = 0; i < n-2; i++) {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        }

        System.out.println(isAns ? "Yes" : "No");
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
} Main public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        }

        boolean isAns = false;
        for (int i = 0; i < n-2; i++) {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        }

        System.out.println(isAns ? "Yes" : "No");
    } main {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        }

        boolean isAns = false;
        for (int i = 0; i < n-2; i++) {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        }

        System.out.println(isAns ? "Yes" : "No");
    } MyScanner sc = new MyScanner(); sc new MyScanner() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[][] d = new int[n][2]; d new int[n][2] n 2 for (int i = 0; i < n; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        } {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        } d[i][0] = sc.nextInt() d[i][0] d[i] d i 0 sc.nextInt() sc.nextInt sc d[i][1] = sc.nextInt() d[i][1] d[i] d i 1 sc.nextInt() sc.nextInt sc boolean isAns = false; isAns false for (int i = 0; i < n-2; i++) {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        } int i = 0; int i = 0; i 0 i < n-2 i n-2 n 2 i++ i++ i {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        } {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        } boolean isTmp = true; isTmp true for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            } int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            } {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            } if (d[i+j][0] != d[i+j][1])
                    isTmp = false; d[i+j][0] != d[i+j][1] d[i+j][0] d[i+j] d i+j i j 0 d[i+j][1] d[i+j] d i+j i j 1 isTmp = false isTmp false if (isTmp == true)
                isAns = true; isTmp == true isTmp true isAns = true isAns true System.out.println(isAns ? "Yes" : "No") System.out.println System.out System System.out isAns ? "Yes" : "No" isAns "Yes" "No" String[] args args static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }
    } MyScanner BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15); reader new BufferedReader(new InputStreamReader(System.in), 1 << 15) StringTokenizer tokenizer; tokenizer String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        } next {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        } try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            } catch (IOException ignored) {
            } IOException ignored {
            } {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        }

        boolean isAns = false;
        for (int i = 0; i < n-2; i++) {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        }

        System.out.println(isAns ? "Yes" : "No");
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
} public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        }

        boolean isAns = false;
        for (int i = 0; i < n-2; i++) {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        }

        System.out.println(isAns ? "Yes" : "No");
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        }

        boolean isAns = false;
        for (int i = 0; i < n-2; i++) {
            boolean isTmp = true;

            for (int j = 0; j < 3; j++) {
                if (d[i+j][0] != d[i+j][1])
                    isTmp = false;
            }

            if (isTmp == true)
                isAns = true;
        }

        System.out.println(isAns ? "Yes" : "No");
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}