fun main() {
    val s = readln()
    val n = readln().toInt()
    val words = HashSet<String>()
    for (i in 0..<n) words.add(readln())
    val L = s.length
    val human = BooleanArray(L + 1)
    human[0] = true
    for (j in 6..L) {
        val start: Int = kotlin.math.max(0, j - 10)
        for (i in start..<j - 5) {
            if (human[i] && words.contains(s.substring(i, j))) {
                human[j] = true
                break
            }
        }
    }
    kotlin.io.println(if (human[L]) "yes" else "no")
}