//package atcoder.beginner_179;

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

public class Main {

    public static void main (String[] args) throws Exception {

        String s = "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int n=nin();
        boolean res = false;
        int c=0;
        for (int i = 0; i<n; ++i) {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        }
        bw.write((res ? "Yes" : "No") + "\n");
        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
} import java.io.*; io.* java import java.util.StringTokenizer; StringTokenizer java.util public class Main {

    public static void main (String[] args) throws Exception {

        String s = "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int n=nin();
        boolean res = false;
        int c=0;
        for (int i = 0; i<n; ++i) {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        }
        bw.write((res ? "Yes" : "No") + "\n");
        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
} Main static BufferedReader br; br static BufferedWriter bw; bw static StringTokenizer st; st public static void main (String[] args) throws Exception {

        String s = "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int n=nin();
        boolean res = false;
        int c=0;
        for (int i = 0; i<n; ++i) {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        }
        bw.write((res ? "Yes" : "No") + "\n");
        bw.flush();

    } main {

        String s = "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int n=nin();
        boolean res = false;
        int c=0;
        for (int i = 0; i<n; ++i) {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        }
        bw.write((res ? "Yes" : "No") + "\n");
        bw.flush();

    } String s = "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2"; s "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2" "3 3\n" "4 4\n" "6 6\n" "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2" "5\n" "1 2\n" "6 6\n" "4 4\n" "3 3\n" "3 2" br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) bw = new BufferedWriter(new OutputStreamWriter(System.out)) bw new BufferedWriter(new OutputStreamWriter(System.out)) rl() rl int n=nin(); n nin() nin boolean res = false; res false int c=0; c 0 for (int i = 0; i<n; ++i) {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        } int i = 0; int i = 0; i 0 i<n i n ++i ++i i {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        } {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        } rl() rl if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            } nin() == nin() nin() nin nin() nin {
                ++c;
            } ++c c {
                c=0;
            } c=0 c 0 if (c==3) res = true; c==3 c 3 res = true res true bw.write((res ? "Yes" : "No") + "\n") bw.write bw (res ? "Yes" : "No") + "\n" (res ? "Yes" : "No") res "Yes" "No" "\n" bw.flush() bw.flush bw String[] args args static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    } rl {
        st = new StringTokenizer(br.readLine());
    } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) static long nlo(){
        return Long.parseLong(st.nextToken());
    } nlo {
        return Long.parseLong(st.nextToken());
    } return Long.parseLong(st.nextToken()); Long.parseLong(st.nextToken()) Long.parseLong Long st.nextToken() st.nextToken st static int nin(){
        return Integer.parseInt(st.nextToken());
    } nin {
        return Integer.parseInt(st.nextToken());
    } return Integer.parseInt(st.nextToken()); Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    } ndo {
        return Double.parseDouble(st.nextToken());
    } return Double.parseDouble(st.nextToken()); Double.parseDouble(st.nextToken()) Double.parseDouble Double st.nextToken() st.nextToken st static char[] nca(){
        return st.nextToken().toCharArray();
    } nca {
        return st.nextToken().toCharArray();
    } return st.nextToken().toCharArray(); st.nextToken().toCharArray() st.nextToken().toCharArray st.nextToken() st.nextToken st static String nstr(){
        return st.nextToken();
    } nstr {
        return st.nextToken();
    } return st.nextToken(); st.nextToken() st.nextToken st public class Main {

    public static void main (String[] args) throws Exception {

        String s = "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int n=nin();
        boolean res = false;
        int c=0;
        for (int i = 0; i<n; ++i) {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        }
        bw.write((res ? "Yes" : "No") + "\n");
        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
} public class Main {

    public static void main (String[] args) throws Exception {

        String s = "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int n=nin();
        boolean res = false;
        int c=0;
        for (int i = 0; i<n; ++i) {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        }
        bw.write((res ? "Yes" : "No") + "\n");
        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
} Main
//package atcoder.beginner_179;

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

public class Main {

    public static void main (String[] args) throws Exception {

        String s = "5\n" +
                "1 2\n" +
                "6 6\n" +
                "4 4\n" +
                "3 3\n" +
                "3 2";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int n=nin();
        boolean res = false;
        int c=0;
        for (int i = 0; i<n; ++i) {
            rl();
            if (nin() == nin()) {
                ++c;
            } else {
                c=0;
            }
            if (c==3) res = true;
        }
        bw.write((res ? "Yes" : "No") + "\n");
        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
}