#include<bits/stdc++.h>
#pragma GCC target("avx2")
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)size(x)
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pii = pair<ll, ll>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve() {
    string s;
    ll n;
    cin >> s >> n;
    ll flag = 0;
    if (sz(s) > 1e4 + 100) s.resize(1e4), flag = 1;
    vector<string> words(n);
    for (auto& x : words) cin >> x;
    unordered_set<string> ws(all(words));
    vector<int> dp(sz(s) + 1);
    dp[0] = 1;
    rep(i, 1, sz(s) + 1) {
        rep(j, 6, min(11ll, i + 1)) {
            dp[i] |= dp[i - j] && ws.count(s.substr(i - j, j));
        }
    }
    if (flag) rep(i,0,10) dp.back() |= end(dp)[~i];
    cout << (dp.back() ? "yes" : "no") << '\n';
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    solve();

    return 0;
}
