#!/usr/bin/env python3

s = input()
words = {input() for _ in range(int(input()))}

is_human = [True] + [False] * len(s)
for j in range(6, len(s) + 1):
    is_human[j] = any(
        s[i:j] in words and is_human[i]
        for i in range(max(0, j - 10), j - 5)
    )
print("yes" if is_human[len(s)] else "no")
