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

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);
    }
    int at=0;

    while(at<ssize(s)) {
        bool found = 0;
        for(int l=6;l<=10 and at+l<=ssize(s);++l) {
            if(d.count(s.substr(at,l))) {
                found=1;
                at+=l;
                break;
            }
        }
        if(!found) break;
    }
    if(at==ssize(s)) cout << "yes\n";
    else cout << "no\n";
}