import java.io.*; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author cteam071 */ public class Raining { public static BufferedReader in; public static void main(String[] args) throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); String line; int base; String result = ""; String[] pole; while((line = in.readLine()) != null){ pole = line.split(" "); int pocet = Integer.parseInt(pole[0]); int[] seruje = new int[pocet]; for (int i = 1; i < pocet +1; i++) { for (int j = 1; j < pocet+1; j++) { if (i!=j){ if (pole[i].charAt(0) == pole[j].charAt(0) || pole[i].charAt(0) == pole[j].charAt(1) || pole[i].charAt(1) == pole[j].charAt(0) || pole[i].charAt(1) == pole[j].charAt(1)) { seruje[i-1] += 1; } } } } int count1 = 0; int count2 = 0; for (int i = 0; i < pocet; i++) { if (seruje[i] >= 2) count1++; else if (seruje[i] == 1) count2++; } if ((count2 > 2) || (count1 + count2 < pocet)) System.out.println("NO"); else System.out.println("YES"); //System.out.println(result); } } }