#!/usr/bin/env python3

s = input()
n = int(input())
f=0
b=0
for _ in range(n):
    word = input()
    f|=s.startswith(word)
    b|=s.endswith(word)
if f and b:
    print("yes")
else:
    print("no")
