import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        boolean flag = false;
        int cnt = 0;
        for (int i=0; i<n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        }

        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }


}
 import java.util.*; util.* java public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        boolean flag = false;
        int cnt = 0;
        for (int i=0; i<n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        }

        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }


} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args void run() {

        int n = sc.nextInt();
        boolean flag = false;
        int cnt = 0;
        for (int i=0; i<n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        }

        if (flag) System.out.println("Yes");
        else System.out.println("No");
    } run {

        int n = sc.nextInt();
        boolean flag = false;
        int cnt = 0;
        for (int i=0; i<n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        }

        if (flag) System.out.println("Yes");
        else System.out.println("No");
    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc boolean flag = false; flag false int cnt = 0; cnt 0 for (int i=0; i<n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        } {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        } int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc int t = sc.nextInt(); t sc.nextInt() sc.nextInt sc if (s == t) cnt++;
            else cnt = 0; s == t s t cnt++ cnt cnt = 0 cnt 0 if (3 <= cnt) flag = true; 3 <= cnt 3 cnt flag = true flag true if (flag) System.out.println("Yes");
        else System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        boolean flag = false;
        int cnt = 0;
        for (int i=0; i<n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        }

        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }


} public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        boolean flag = false;
        int cnt = 0;
        for (int i=0; i<n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        }

        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }


} Main
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        boolean flag = false;
        int cnt = 0;
        for (int i=0; i<n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            if (s == t) cnt++;
            else cnt = 0;
            if (3 <= cnt) flag = true;
        }

        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }


}

