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

import static java.lang.Integer.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st;
        int t = parseInt(in.readLine());
        int cnt = 0;
        for (int i = 0; i < t; i++) {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        }
        if (cnt >= 3) pw.println("Yes");
        else pw.println("No");
        pw.close();
    }

    static void solve() {

    }
} import java.io.*; io.* java import java.util.*; util.* java import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st;
        int t = parseInt(in.readLine());
        int cnt = 0;
        for (int i = 0; i < t; i++) {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        }
        if (cnt >= 3) pw.println("Yes");
        else pw.println("No");
        pw.close();
    }

    static void solve() {

    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st;
        int t = parseInt(in.readLine());
        int cnt = 0;
        for (int i = 0; i < t; i++) {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        }
        if (cnt >= 3) pw.println("Yes");
        else pw.println("No");
        pw.close();
    } main {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st;
        int t = parseInt(in.readLine());
        int cnt = 0;
        for (int i = 0; i < t; i++) {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        }
        if (cnt >= 3) pw.println("Yes");
        else pw.println("No");
        pw.close();
    } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) StringTokenizer st; st int t = parseInt(in.readLine()); t parseInt(in.readLine()) parseInt in.readLine() in.readLine in int cnt = 0; cnt 0 for (int i = 0; i < t; i++) {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        } int i = 0; int i = 0; i 0 i < t i t i++ i++ i {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        } {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        } st = new StringTokenizer(in.readLine()) st new StringTokenizer(in.readLine()) int D1 = parseInt(st.nextToken()) D1 parseInt(st.nextToken()) parseInt st.nextToken() st.nextToken st D2 = parseInt(st.nextToken()); D2 parseInt(st.nextToken()) parseInt st.nextToken() st.nextToken st if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0; D1 == D2 D1 D2 cnt++ cnt if (cnt < 3) cnt = 0; cnt < 3 cnt 3 cnt = 0 cnt 0 if (cnt >= 3) pw.println("Yes");
        else pw.println("No"); cnt >= 3 cnt 3 pw.println("Yes") pw.println pw "Yes" pw.println("No") pw.println pw "No" pw.close() pw.close pw String[] args args static void solve() {

    } solve {

    } public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st;
        int t = parseInt(in.readLine());
        int cnt = 0;
        for (int i = 0; i < t; i++) {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        }
        if (cnt >= 3) pw.println("Yes");
        else pw.println("No");
        pw.close();
    }

    static void solve() {

    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st;
        int t = parseInt(in.readLine());
        int cnt = 0;
        for (int i = 0; i < t; i++) {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        }
        if (cnt >= 3) pw.println("Yes");
        else pw.println("No");
        pw.close();
    }

    static void solve() {

    }
} Main
import java.io.*;
import java.util.*;

import static java.lang.Integer.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st;
        int t = parseInt(in.readLine());
        int cnt = 0;
        for (int i = 0; i < t; i++) {
            st = new StringTokenizer(in.readLine());
            int D1 = parseInt(st.nextToken()), D2 = parseInt(st.nextToken());
            if (D1 == D2) cnt++;
            else if (cnt < 3) cnt = 0;

        }
        if (cnt >= 3) pw.println("Yes");
        else pw.println("No");
        pw.close();
    }

    static void solve() {

    }
}
