import java.util.*;

public class Main{
    static Scanner sc = new Scanner(System.in);
        
    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int count = 0;
        for(int i = 0;i<n;i++){
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} import java.util.*; util.* java public class Main{
    static Scanner sc = new Scanner(System.in);
        
    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int count = 0;
        for(int i = 0;i<n;i++){
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int count = 0;
        for(int i = 0;i<n;i++){
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } main {
        int n = Integer.parseInt(sc.nextLine());
        int count = 0;
        for(int i = 0;i<n;i++){
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int count = 0; count 0 for(int i = 0;i<n;i++){
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        } {
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        } String temp = sc.nextLine(); temp sc.nextLine() sc.nextLine sc if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            } temp.charAt(0) == temp.charAt(2) temp.charAt(0) temp.charAt temp 0 temp.charAt(2) temp.charAt temp 2 {
                count++;
            } count++ count {
                count = 0;
            } count = 0 count 0 if(count == 3){
                System.out.println("Yes");
                return;
            } count == 3 count 3 {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main{
    static Scanner sc = new Scanner(System.in);
        
    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int count = 0;
        for(int i = 0;i<n;i++){
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} public class Main{
    static Scanner sc = new Scanner(System.in);
        
    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int count = 0;
        for(int i = 0;i<n;i++){
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main
import java.util.*;

public class Main{
    static Scanner sc = new Scanner(System.in);
        
    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int count = 0;
        for(int i = 0;i<n;i++){
            String temp = sc.nextLine();
            if(temp.charAt(0) == temp.charAt(2)){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}