import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] d1 = new Integer[n];
        Integer[] d2 = new Integer[n];
        for (int i = 0; i < n; i++) {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        // 主処理
        boolean judge = false;
        int renzoku = 0;
        for (int i = 0; i < n; i++) {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] d1 = new Integer[n];
        Integer[] d2 = new Integer[n];
        for (int i = 0; i < n; i++) {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        // 主処理
        boolean judge = false;
        int renzoku = 0;
        for (int i = 0; i < n; i++) {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
} Main public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] d1 = new Integer[n];
        Integer[] d2 = new Integer[n];
        for (int i = 0; i < n; i++) {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        // 主処理
        boolean judge = false;
        int renzoku = 0;
        for (int i = 0; i < n; i++) {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    } main {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] d1 = new Integer[n];
        Integer[] d2 = new Integer[n];
        for (int i = 0; i < n; i++) {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        // 主処理
        boolean judge = false;
        int renzoku = 0;
        for (int i = 0; i < n; i++) {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Integer[] d1 = new Integer[n]; d1 new Integer[n] n Integer[] d2 = new Integer[n]; d2 new Integer[n] n for (int i = 0; i < n; i++) {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        } {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        } d1[i] = Integer.parseInt(sc.next()) d1[i] d1 i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc d2[i] = Integer.parseInt(sc.next()) d2[i] d2 i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc boolean judge = false; judge false int renzoku = 0; renzoku 0 for (int i = 0; i < n; i++) {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        } {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        } if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            } d1[i] == d2[i] d1[i] d1 i d2[i] d2 i {
                renzoku++;
            } renzoku++ renzoku {
                renzoku = 0;
            } renzoku = 0 renzoku 0 if (renzoku == 3) {
                judge = true;
                break;
            } renzoku == 3 renzoku 3 {
                judge = true;
                break;
            } judge = true judge true break; String result = judge ? "Yes" : "No"; result judge ? "Yes" : "No" judge "Yes" "No" System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] d1 = new Integer[n];
        Integer[] d2 = new Integer[n];
        for (int i = 0; i < n; i++) {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        // 主処理
        boolean judge = false;
        int renzoku = 0;
        for (int i = 0; i < n; i++) {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
} public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] d1 = new Integer[n];
        Integer[] d2 = new Integer[n];
        for (int i = 0; i < n; i++) {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        // 主処理
        boolean judge = false;
        int renzoku = 0;
        for (int i = 0; i < n; i++) {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] d1 = new Integer[n];
        Integer[] d2 = new Integer[n];
        for (int i = 0; i < n; i++) {
            d1[i] = Integer.parseInt(sc.next());
            d2[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        // 主処理
        boolean judge = false;
        int renzoku = 0;
        for (int i = 0; i < n; i++) {
            if (d1[i] == d2[i]) {
                renzoku++;
            } else {
                renzoku = 0;
            }
            if (renzoku == 3) {
                judge = true;
                break;
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
}
