#!/usr/bin/env python3
from functools import cache
from sys import setrecursionlimit


@cache
def is_human(j: int) -> bool:
    if j == 0: return True
    if j < 6:
        return False
    for i in range(max(0, j - 10), j - 5):
        if s[i:j] in words and is_human(i):
            return True
    return False


setrecursionlimit(1000000)
s = input()
words = {input() for _ in range(int(input()))}
print("yes" if is_human(len(s)) else "no")
