#include <iostream>
#include <string>
#include <unordered_set>
#include <vector>

int main(){
    std::string s;
    int m;
    std::cin >> s >> m;
    std::unordered_set<std::string> ws;
    for (int i = 0; i < m; ++i){
        std::string w;
        std::cin >> w;
        ws.insert(w);
    }
    int n = s.size();
    std::vector<bool> p(n+1);
    p[0] = true;
    for (int i = 0; i < n; ++i) if (p[i]) for (int x = 6; x <= 10; ++x) if (s.size() >= i+x && ws.count(s.substr(i,x))) p[i+x] = true;
    std::cout << (p[n] ? "yes" : "no") << std::endl;
    return 0;
}
