#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

const int TN = 1e6 + 1;
const int SN = 30 + 1;
const int VN = 1e5 + 1; // Summary length = vertices in trie
const int N = 1e5;

char t[TN], s[SN];
int n, root = 0, vn = 1, End[VN], Next[VN][26];
bool is[N];

void add( int i, const char *s ) {
  int v = root;
  while (*s) {
    int &r = Next[v][*s++ - 'a'];
    if (!r)
      r = vn++;
    v = r;
  }
  End[v] = i;
}

int main() {
  gets(t);
  scanf("%d ", &n);
  memset(End, -1, sizeof(End));
  forn(i, n) {
    gets(s);
    add(i, s);
  }
  for (int i = 0; t[i]; i++) {
    int v = root;
    for (int j = i; t[j]; j++) {
      v = Next[v][t[j] - 'a'];
      if (!v)
        break;
      if (End[v] != -1)
        is[End[v]] = 1;
    }
  }
  forn(i, n)
    puts(is[i] ? "Yes" : "No");
}