#!/usr/bin/env python3
from collections import defaultdict, deque

s = input()
half_trie = defaultdict(list)
for _ in range(int(input())):
    word = input()
    half_trie[word[:6]].append(word[6:])
q = deque([0])
while q:
    i = q.popleft()
    prefix = s[i : i + 6]
    if not half_trie[prefix]:
        continue
    i += 6
    for suffix in half_trie[prefix]:
        j = i + len(suffix)
        if s[i:j] == suffix:
            if j == len(s):
                exit(print("yes"))
            if j not in q:
                q.append(j)
print("no")
