#include <bits/stdc++.h>
using namespace std;
const int LEN = 600005;
const int MOD1 = 1000000007;
const int MOD2 = 1000000009;
const int BASE1 = 11;
const int BASE2 = 13;
inline int val(char ch) { return ch - 'a' + 1; }
int n, m;
string s;
set<pair<int, int> > S;
int POW1[LEN];
int POW2[LEN];
int HASH1[LEN];
int HASH2[LEN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  POW1[0] = 1;
  POW2[0] = 1;
  for (int i = 1; i < LEN; i++) {
    POW1[i] = (long long)POW1[i - 1] * BASE1 % MOD1;
    POW2[i] = (long long)POW2[i - 1] * BASE2 % MOD2;
  }
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s;
    int hash1 = 0;
    int hash2 = 0;
    for (int j = 0; j < s.size(); j++) {
      hash1 += (long long)POW1[j] * val(s[j]) % MOD1;
      hash1 %= MOD1;
      hash2 += (long long)POW2[j] * val(s[j]) % MOD2;
      hash2 %= MOD2;
    }
    S.insert(make_pair(hash1, hash2));
  }
  for (int i = 0; i < m; i++) {
    cin >> s;
    int hash1 = 0;
    int hash2 = 0;
    for (int j = 0; j < s.size(); j++) {
      hash1 += (long long)POW1[j] * val(s[j]) % MOD1;
      hash1 %= MOD1;
      hash2 += (long long)POW2[j] * val(s[j]) % MOD2;
      hash2 %= MOD2;
    }
    bool ok = false;
    for (int j = 0; j < s.size(); j++) {
      int val1 = hash1;
      val1 -= (long long)POW1[j] * val(s[j]) % MOD1;
      if (val1 < 0) {
        val1 += MOD1;
      }
      int val2 = hash2;
      val2 -= (long long)POW2[j] * val(s[j]) % MOD2;
      if (val2 < 0) {
        val2 += MOD2;
      }
      for (int k = 0; k < 3; k++) {
        char ch = "abc"[k];
        if (ch == s[j]) {
          continue;
        }
        int x = val1;
        x += (long long)POW1[j] * val(ch) % MOD1;
        x %= MOD1;
        int y = val2;
        y += (long long)POW2[j] * val(ch) % MOD2;
        y %= MOD2;
        if (S.find(make_pair(x, y)) != S.end()) {
          ok = true;
          break;
        }
      }
      if (ok) {
        break;
      }
    }
    cout << (ok ? "YES" : "NO") << "\n";
  }
}
