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

class Main {
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() { // reads in the next string
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        } // reads in the next int

        public long nextLong() {
            return Long.parseLong(next());
        } // reads in the next long

        public double nextDouble() {
            return Double.parseDouble(next());
        } // reads in the next double
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        int number_of_rolls = r.nextInt();
        int num1 = 0, num2 = 0, plays = 0, inArow = 0, repeated = 0, notRepeating = 0;
        boolean good = false;
        while (plays < number_of_rolls) {
            num1 = r.nextInt();
            num2 = r.nextInt();
            if (num1 == num2) {
                repeated++;
            } else {
                repeated = 0;
            }
            if (repeated == 3) {
                good = true;
            }
            plays++;
        }
        if (good) {
            pw.println("Yes");
        } else {
            pw.println("No");
        }

        pw.close(); // flushes the output once printing is done
    }
} import java.io.*; io.* java import java.util.StringTokenizer; StringTokenizer java.util class Main {
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() { // reads in the next string
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        } // reads in the next int

        public long nextLong() {
            return Long.parseLong(next());
        } // reads in the next long

        public double nextDouble() {
            return Double.parseDouble(next());
        } // reads in the next double
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        int number_of_rolls = r.nextInt();
        int num1 = 0, num2 = 0, plays = 0, inArow = 0, repeated = 0, notRepeating = 0;
        boolean good = false;
        while (plays < number_of_rolls) {
            num1 = r.nextInt();
            num2 = r.nextInt();
            if (num1 == num2) {
                repeated++;
            } else {
                repeated = 0;
            }
            if (repeated == 3) {
                good = true;
            }
            plays++;
        }
        if (good) {
            pw.println("Yes");
        } else {
            pw.println("No");
        }

        pw.close(); // flushes the output once printing is done
    }
} Main static InputReader r = new InputReader(System.in); r new InputReader(System.in) static PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) public static void main(String[] args) {
        int number_of_rolls = r.nextInt();
        int num1 = 0, num2 = 0, plays = 0, inArow = 0, repeated = 0, notRepeating = 0;
        boolean good = false;
        while (plays < number_of_rolls) {
            num1 = r.nextInt();
            num2 = r.nextInt();
            if (num1 == num2) {
                repeated++;
            } else {
                repeated = 0;
            }
            if (repeated == 3) {
                good = true;
            }
            plays++;
        }
        if (good) {
            pw.println("Yes");
        } else {
            pw.println("No");
        }

        pw.close(); // flushes the output once printing is done
    } main {
        int number_of_rolls = r.nextInt();
        int num1 = 0, num2 = 0, plays = 0, inArow = 0, repeated = 0, notRepeating = 0;
        boolean good = false;
        while (plays < number_of_rolls) {
            num1 = r.nextInt();
            num2 = r.nextInt();
            if (num1 == num2) {
                repeated++;
            } else {
                repeated = 0;
            }
            if (repeated == 3) {
                good = true;
            }
            plays++;
        }
        if (good) {
            pw.println("Yes");
        } else {
            pw.println("No");
        }

        pw.close(); // flushes the output once printing is done
    } int number_of_rolls = r.nextInt(); number_of_rolls r.nextInt() r.nextInt r int num1 = 0 num1 0 num2 = 0 num2 0 plays = 0 plays 0 inArow = 0 inArow 0 repeated = 0 repeated 0 notRepeating = 0; notRepeating 0 boolean good = false; good false while (plays < number_of_rolls) {
            num1 = r.nextInt();
            num2 = r.nextInt();
            if (num1 == num2) {
                repeated++;
            } else {
                repeated = 0;
            }
            if (repeated == 3) {
                good = true;
            }
            plays++;
        } plays < number_of_rolls plays number_of_rolls {
            num1 = r.nextInt();
            num2 = r.nextInt();
            if (num1 == num2) {
                repeated++;
            } else {
                repeated = 0;
            }
            if (repeated == 3) {
                good = true;
            }
            plays++;
        } num1 = r.nextInt() num1 r.nextInt() r.nextInt r num2 = r.nextInt() num2 r.nextInt() r.nextInt r if (num1 == num2) {
                repeated++;
            } else {
                repeated = 0;
            } num1 == num2 num1 num2 {
                repeated++;
            } repeated++ repeated {
                repeated = 0;
            } repeated = 0 repeated 0 if (repeated == 3) {
                good = true;
            } repeated == 3 repeated 3 {
                good = true;
            } good = true good true plays++ plays if (good) {
            pw.println("Yes");
        } else {
            pw.println("No");
        } good {
            pw.println("Yes");
        } pw.println("Yes") pw.println pw "Yes" {
            pw.println("No");
        } pw.println("No") pw.println pw "No" pw.close() pw.close pw String[] args args static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() { // reads in the next string
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        } // reads in the next int

        public long nextLong() {
            return Long.parseLong(next());
        } // reads in the next long

        public double nextDouble() {
            return Double.parseDouble(next());
        } // reads in the next double
    } InputReader BufferedReader reader; reader StringTokenizer tokenizer; tokenizer public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } InputReader {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } reader = new BufferedReader(new InputStreamReader(stream), 32768) reader new BufferedReader(new InputStreamReader(stream), 32768) tokenizer = null tokenizer null InputStream stream stream String next() { // reads in the next string
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } next { // reads in the next string
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public int nextInt() {
            return Integer.parseInt(next());
        } // reads in the next int nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
            return Long.parseLong(next());
        } // reads in the next long nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public double nextDouble() {
            return Double.parseDouble(next());
        } // reads in the next double nextDouble {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next
import java.io.*;
import java.util.StringTokenizer;

class Main {
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() { // reads in the next string
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        } // reads in the next int

        public long nextLong() {
            return Long.parseLong(next());
        } // reads in the next long

        public double nextDouble() {
            return Double.parseDouble(next());
        } // reads in the next double
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        int number_of_rolls = r.nextInt();
        int num1 = 0, num2 = 0, plays = 0, inArow = 0, repeated = 0, notRepeating = 0;
        boolean good = false;
        while (plays < number_of_rolls) {
            num1 = r.nextInt();
            num2 = r.nextInt();
            if (num1 == num2) {
                repeated++;
            } else {
                repeated = 0;
            }
            if (repeated == 3) {
                good = true;
            }
            plays++;
        }
        if (good) {
            pw.println("Yes");
        } else {
            pw.println("No");
        }

        pw.close(); // flushes the output once printing is done
    }
}
