import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int count = 0;
        String ans = "No";
        for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        }

        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int count = 0;
        String ans = "No";
        for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int count = 0;
        String ans = "No";
        for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        }

        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int count = 0;
        String ans = "No";
        for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        }

        System.out.println(ans);
    } 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 int count = 0; count 0 String ans = "No"; ans "No" for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        } {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        } count = sc.next().equals(sc.next()) ? count + 1 : 0 count sc.next().equals(sc.next()) ? count + 1 : 0 sc.next().equals(sc.next()) sc.next().equals sc.next() sc.next sc sc.next() sc.next sc count + 1 count 1 0 if(count == 3) {
                ans = "Yes";
            } count == 3 count 3 {
                ans = "Yes";
            } ans = "Yes" ans "Yes" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int count = 0;
        String ans = "No";
        for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        }

        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int count = 0;
        String ans = "No";
        for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        }

        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int count = 0;
        String ans = "No";
        for (int i = 0; i < n; i++) {
            count = sc.next().equals(sc.next()) ? count + 1 : 0;
            if(count == 3) {
                ans = "Yes";
            }
        }

        System.out.println(ans);
    }
}