import sys

ranks = {"A": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "X": 10, "J": 11, "Q": 12, "K": 13}
suits = {"C": 0, "D": 1, "H": 2, "S": 3}



RANK = 0
SUIT = 1

class Node():
	def __init__(self, depth, rank, suit, cards_can_use, n_of_cards):
		global end_tree
		self.rank = rank
		self.suit = suit
		self.children = []
		self.depth = depth
		self.cards_can_use = cards_can_use
		self.fict_cards_can_use = self.cards_can_use
		self.n_of_cards = n_of_cards
		
		if self.depth == self.n_of_cards:
			print("YES")
			end_tree = True
		
		if end_tree:
			return
			
		
		if len(self.cards_can_use) > 0:
			for card in self.cards_can_use:
				if (self.rank == card[RANK]) or (self.suit == card[SUIT]):
					self.fict_cards_can_use.remove((card[RANK], card[SUIT]))
					self.children.append(Node(depth + 1, card[RANK], card[SUIT], self.fict_cards_can_use, self.n_of_cards))
					self.fict_cards_can_use.add((card[RANK], card[SUIT]))

end_tree = False



def get_input():
	lines = []
	for line in sys.stdin:
		lines.append(line)
	return lines

def print_tree(node):
	print("{}: {}{}".format(node.depth, ranks[node.rank], suits[node.suit]))
	for child in node.children:
		print_tree(child)

def create_tree(cards, n_of_cards):
	global end_tree
	if n_of_cards > 37:
		print("YES")
	else:
		for card in cards:
			tree = Node( 1, card[RANK], card[SUIT], cards, n_of_cards )
			if end_tree:
				break
		if not end_tree:
			print("NO")
	end_tree = False
	found = False
		
lines = get_input()

cards = set()


for line in lines:
	split = line.split()
	n_of_cards = split[0]
	for card in split[1:]:
		rank = ranks[card[0]]
		suit = suits[card[1]]
		cards.add((rank, suit))
	create_tree(cards, int(n_of_cards))
	cards = set()


	
		
		
	
	
	
	
	
	
	
	
