#include <bits/stdc++.h>   using namespace std;   template <class T1, class T2, class T3>   bool _IN(T1 x, T2 y, T3 z) {     return x <= y && x >= z || x <= z && x >= y;   }   unsigned long long gcd(unsigned long long a, unsigned long long b) {     if (!b) return a;     while (b ^= a ^= b ^= a %= b)       ;     return a;   }   extern const long long mod;   long long ksm(long long a, long long b) {     long long res = 1;     a %= mod;     for (; b; b >>= 1) {       if (b & 1) res = res * a % mod;       a = a * a % mod;     }     return res;   }   char DATaJNTFnlmAoya[2];   double PDlaQLoCkCjCKyr;   bool S(char* a) { return scanf( %s , a) == 1; }   bool S(int& a) { return scanf( %d , &a) == 1; }   bool S(bool& a) { return scanf( %d , &a) == 1; }   bool S(unsigned& a) { return scanf( %u , &a) == 1; }   bool S(float& a) { return scanf( %f , &a) == 1; }   bool S(double& a) { return scanf( %lf , &a) == 1; }   bool S(long long& a) { return scanf( %I64d , &a) == 1; }   bool S(unsigned long long& a) { return scanf( %I64u , &a) == 1; }   bool S(long double& a) {     if (scanf( %lf , &PDlaQLoCkCjCKyr) == -1) return 0;     a = PDlaQLoCkCjCKyr;     return 1;   }   bool S(char& a) {     if (scanf( %1s , DATaJNTFnlmAoya) == -1) return 0;     a = *DATaJNTFnlmAoya;     return 1;   }   bool SL(char* a) {     a[0] = 0;     while (gets(a) && !a[0])       ;     return a[0];   }   void _P(const int& x) { printf( %d , x); }   void _P(const bool& x) { printf( %d , x); }   void _P(const unsigned& x) { printf( %u , x); }   void _P(const char& x) { printf( %c , x); }   void _P(const char* x) { printf( %s , x); }   void _P(const string& x) { printf( %s , x.c_str()); }   void _P(const long long& x) { printf( %I64d , x); }   void _P(const unsigned long long& x) { printf( %I64u , x); }   void _P(const float& x) { printf( %.2f , x); }   void _P(const double& x) { printf( %.2f , x); }   void _P(const long double& x) { printf( %.2f , (double)x); }   template <class T1, class T2>   bool S(T1& a, T2& b) {     return S(a) + S(b) == 2;   }   template <class T1, class T2, class T3>   bool S(T1& a, T2& b, T3& c) {     return S(a) + S(b) + S(c) == 3;   }   template <class T1, class T2, class T3, class T4>   bool S(T1& a, T2& b, T3& c, T4& d) {     return S(a) + S(b) + S(c) + S(d) == 4;   }   template <class T1, class T2, class T3, class T4, class T5>   bool S(T1& a, T2& b, T3& c, T4& d, T5& e) {     return S(a) + S(b) + S(c) + S(d) + S(e) == 5;   }   template <class T1>   void P(const T1& a) {     _P(a);     putchar(   );   }   template <class T1, class T2>   void P(const T1& a, const T2& b) {     _P(a);     putchar(   );     _P(b);     putchar(   );   }   template <class T1>   void PN(const T1& a) {     _P(a);     puts(  );   }   template <class T1, class T2>   void PN(const T1& a, const T2& b) {     _P(a);     putchar(   );     _P(b);     puts(  );   }   template <class T1, class T2, class T3>   void PN(const T1& a, const T2& b, const T3& c) {     _P(a);     putchar(   );     _P(b);     putchar(   );     _P(c);     puts(  );   }   template <class T1, class T2, class T3, class T4>   void PN(const T1& a, const T2& b, const T3& c, const T4& d) {     _P(a);     putchar(   );     _P(b);     putchar(   );     _P(c);     putchar(   );     _P(d);     puts(  );   }   template <class T1, class T2, class T3, class T4, class T5>   void PN(const T1& a, const T2& b, const T3& c, const T4& d, const T5& e) {     _P(a);     putchar(   );     _P(b);     putchar(   );     _P(c);     putchar(   );     _P(d);     putchar(   );     _P(e);     puts(  );   }   template <class T>   void PA(T* a, int n) {     for (long long i = 0, pJNwFPtlXiwFoIv = (n - 1); i < pJNwFPtlXiwFoIv; i++)       _P(a[i]), putchar(   );     PN(a[n - 1]);   }   template <class T>   void PA(const T& x) {     for (__typeof((x).begin()) it = (x).begin(), CluhxSchFuDeugk = (x).end();          it != CluhxSchFuDeugk; it++) {       _P(*it);       if (it == --x.end())         puts(  );       else         putchar(   );     }   }   int kase;   const double pi = 4 * atan(1);   const double ep = 1e-9;   const int INF = 0x3f3f3f3f;   const long long INFL = 0x3f3f3f3f3f3f3f3fll;   const long long mod = 1000000007;   template <long long mod, long long lim, int MAX_D>   struct Hash_set {     struct node {       string x;       node* next;       node(node* a = 0, const string& b =   ) : next(a), x(b) {}       void add(const string& a) {         erase(a);         next = new node(next, a);       }       bool find(const string& a) {         node* cur = next;         while (cur) {           if (cur->x == a) return 1;           cur = cur->next;         }         return 0;       }       void clear() {         while (next) {           node* tmp = next->next;           delete next;           next = tmp;         }       }       void erase(const string& a) {         node *cur = next, *p = this;         while (cur) {           if (cur->x == a) {             node* tmp = cur;             p->next = cur->next;             delete cur;             cur = p->next;           }           if (!cur) break;           p = cur;           cur = cur->next;         }       }     };     long long* d;     node* ha;     Hash_set() {       ha = new node[mod];       d = new long long[MAX_D];       d[0] = 1;       for (int i = 1; i < MAX_D; i++) d[i] = d[i - 1] * lim % mod;     }     ~Hash_set() {       for (int i = 0; i < mod; i++) ha[i].clear();       delete[] ha;       delete[] d;     }     long long hash(const string& x) {       long long res = 0;       for (int i = 0; i < x.size(); i++) res = (res + x[i] * d[i]) % mod;       return res;     }     bool find(const string& x, int h = -1) {       if (h == -1) h = hash(x);       return ha[h].find(x);     }     void insert(const string& x, int h = -1) {       if (h == -1) h = hash(x);       ha[h].add(x);     }     void erase(const string& x, int h = -1) {       if (h == -1) h = hash(x);       ha[h].erase(x);     }     void clear() {       for (int i = 0; i < mod; i++) ha[i].clear();     }     int convert(long long h, int where, char from, char to) {       return ((h + ((long long)to - from) * d[where]) % mod + mod) % mod;     }   };   char bf[600005];   Hash_set<600011, 311, 600000> x;   bool OK() {     S(bf);     string cur = bf;     long long ha = x.hash(cur);     for (long long i = 0, pJNwFPtlXiwFoIv = (cur.size()); i < pJNwFPtlXiwFoIv;          i++) {       char c = cur[i];       for (long long j = ( a ), alVDbhLBoMEGSwA = ( c ); j <= alVDbhLBoMEGSwA;            j++) {         if (j == c) continue;         cur[i] = j;         long long ch = x.convert(ha, i, c, j);         if (x.find(cur, ch)) return 1;       }       cur[i] = c;     }     return 0;   }   int main() {     ;     int n, m;     S(n, m);     while (n--) {       S(bf);       x.insert(bf);     }     while (m--) {       puts(OK() ?  YES  :  NO );     }   }