make-the-word
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

One day alice and bob were playing with their old toys , they had moved all the rakes and drawers to in the pursuit of their childhood toys.
Finally they found  bunch of cubes ,with letters and digits written on it ,which they recalled they  used to make words from.
They  have already come up with a word they  would like to make.
Could you help him by saying if the word can be built from the cubes in the drawer?

Input
On the first line of input there is a string S, consisting of lowercase 
English letters, and an integer N (4≤|S|≤100, 1≤N≤100) – the word Bob and Alice wants 
to build and the number of cubes. On the every of the following N lines 
there are 6 characters. Every of those characters is either a lowercase 
English letter or a digit.

It is guaranteed that the string S consists only of lowercase English letters.

Output

Output one word, either "YES", if the word can be built using given cubes, or "NO" otherwise.

SAMPLE TEST CASE

INPUT 

egos 4

d 1 w e 7 9

o 2 h a v e

g 3 c o o k

s 3 i e s 5

OUTPUT

YES

SAMPLE INPUT
egos 4
d 1 w e 7 9
o 2 h a v e
g 3 c o o k
s 3 i e s 5

SAMPLE OUTPUT
YES


a,b=list(map(str,input().split()))
fnd=[]
f=0
for i in range(int(b)):
	l=list(map(str,input().split()))
	for i in range(len(a)):
		if i not in fnd:
			if a[i] in l:
				fnd.append(i)
				break
	if len(fnd)==len(a):
		f=1
		break
if(f):
	print('YES')
else:
	print('NO')