#include <iostream>
using namespace std;

int main() {
    string s;
    cin >> s;
    int n;
    cin >> n;
    while (n--) {
        string t;
        cin >> t;
        int pos = 0;
        bool is = 1;
        for (char c : t) {
            int p = 0;
            p = s.find(c, pos);
            if (p == string::npos) {
                is = 0;
                break;
            }
            pos = p + 1;
        }
        if (is) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}
// 64 位输出请用 printf("%lld")