#include <iostream>
#include <set>
#include <string>
using namespace std;

// This backtracking solution would be too slow if the input string is fixed to "aaa..." for the many-duplicates cases.
int main() {
    string s; cin >> s;
    int n; cin >> n;
    set<string> d;
    for(int i=0;i<n;++i) {
        string w; cin >> w;
        d.insert(w);
    }
    auto rec = [&](auto&& self, int at) -> bool {
        if(at==ssize(s)) {
            return true;
        }
        for(int l=6;l<=10 and at+l<=ssize(s);++l) {
            if(d.count(s.substr(at,l))) {
                if(self(self,at+l)) return true;
            }
        }
        return false;
    };
    if(rec(rec,0)) cout << "yes\n";
    else cout << "no\n";
}