#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    string s, word;
    cin >> s;

    int n;
    cin >> n;
    vector<string> words;
    for (int i = 0; i < n; ++i) {
        cin >> word;
        words.push_back(word);
    }

    vector<bool> is_human(s.length() + 1, false);
    is_human[0] = true;

    for (int j = 6; j <= s.length(); ++j) {
        for (int i = max(0, j - 10); i < j - 5; ++i) {
            if (find(words.begin(), words.end(), s.substr(i, j - i)) != words.end() && is_human[i]) {
                is_human[j] = true;
                break;
            }
        }
    }

    cout << (is_human[s.length()] ? "yes" : "no") << endl;
}
