#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1110111110111;
const int siz = 1000001;
set<ll>ss;
ll A = 11,n,m,base[siz];
ll get_hash(string s)
{
    ll ret = 0;
    for(int i = 0;i<s.size();i++)
    {
        ret+=s[i]*base[i]; ret%=mod;
    }
    return ret;
}
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   base[0] = 1;
   for(int i = 1;i<siz;i++)  base[i] = (base[i-1]*A)%mod;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       ss.insert(get_hash(s));
   }
   while(m--)
   {
       string s; cin>>s;
       ll cur = get_hash(s);
       int p = 0;
       for(int i = 0;i<s.size();i++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               ll t = cur+(c-s[i])*base[i];
               t+=1LL*4*mod; t%=mod;
               if(ss.count(t)) p = 1;
           }
       }
       if(p) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1110111110111;
const int siz = 1000001;
set<int>ss;
int A = 11,n,m,base[siz];
int get_hash(string s)
{
    int ret = 0;
    for(int i = 0;i<s.size();i++)
    {
        ret+=s[i]*base[i]; ret%=mod;
    }
    return ret;
}
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   base[0] = 1;
   for(int i = 1;i<siz;i++)  base[i] = (base[i-1]*A)%mod;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       ss.insert(get_hash(s));
   }
   while(m--)
   {
       string s; cin>>s;
       int cur = get_hash(s);
       int p = 0;
       for(int i = 0;i<s.size();i++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               int t = cur+(c-s[i])*base[i];
               t+=mod; t%=mod;
               if(ss.count(t)) p = 1;
           }
       }
       if(p) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1110111110111;
const int siz = 1000001;
set<ll>ss;
ll A = 11,n,m,base[siz];
ll get_hash(string s)
{
    ll ret = 0;
    for(int i = 0;i<s.size();i++)
    {
        ret+=s[i]*base[i]; ret%=mod;
    }
    return ret;
}
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   base[0] = 1;
   for(int i = 1;i<siz;i++)  base[i] = (base[i-1]*A)%mod;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       ss.insert(get_hash(s));
   }
   while(m--)
   {
       string s; cin>>s;
       ll cur = get_hash(s);
       int p = 0;
       for(int i = 0;i<s.size();i++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               ll t = cur+(c-s[i])*base[i];
               t+=4*mod; t%=mod;
               if(ss.count(t)) p = 1;
           }
       }
       if(p) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include <bits/stdc++.h>
#define int long long
#define FOR(i,a,b) for(int i=a; i<b; i++)
using namespace std;
const int N = 1000001, A = 11, MOD =  1110111110111;
int n, m, base[N];
set<int> S;
string t;
int get_hash(string s){
	int ret = 0;
	FOR(i,0,s.size()){
		ret += s[i]*base[i];
		ret %= MOD;
	}
	return ret;
}
int32_t main(){
	base[0] = 1;
	FOR(i,1,N)
		base[i] = base[i-1]*A % MOD;
	cin>>n>>m;
	while(n--){
		cin>>t;
		S.insert(get_hash(t));
	}
	while(m--){
		int p = 0; string s;
		cin>>s;
		int cur = get_hash(s);
		       for(int i = 0;i<s.size();i++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               int t = cur+(c-s[i])*base[i];
               t+=4*MOD; t%=MOD;
               if(S.count(t)) p = 1;
           }
       }
		cout<<(p ? "YES\n":"NO\n");
	}
}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
const int siz = 3e5+5;
int n,m,a[siz];
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   map<string,int>mp;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       for(int j = 0;j<s.size();j++)
       {
           for(char c = 'a';c<='z';c++)
           {
               if(c == s[j]) continue;
               string cur = s; cur[j] = c;
               mp[cur] = 1;
           }
       }
   }
   while(m--)
   {
       string s; cin>>s;
       if(mp[s]) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
const int siz = 3e5+5;
int n,m,a[siz];
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   map<string,int>mp;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       mp[s] = 1;
   }
   while(m--)
   {
       string s; cin>>s;
       int p = 0;
       for(int i = 0;i<s.size();i++)
       {
           if(p) break;
           string cur = s;
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               cur[i] = c;
               if(mp[cur]) p = 1;
           }
       }
       if(p) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1110111110111;
const int siz = 1000001;
set<ll>ss;
ll A = 11,n,m,base[siz];
ll get_hash(string s)
{
    ll ret = 0;
    for(int i = 0;i<s.size();i++)
    {
        ret+=s[i]*base[i]; ret%=mod;
    }
    return ret;
}
int32_t main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   base[0] = 1;
   for(int i = 1;i<siz;i++)  base[i] = (base[i-1]*A)%mod;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       ss.insert(get_hash(s));
   }
   while(m--)
   {
       string s; cin>>s;
       ll cur = get_hash(s);
       int p = 0;
       for(int i = 0;i<s.size();i++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               ll t = cur+(c-s[i])*base[i];
               t+=1LL*4*mod; t%=mod;
               if(ss.count(t)) p = 1;
           }
       }
       if(p) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1110111110111;
const int siz = 1e6+5;
set<int>ss;
int A = 11,n,m,a[siz],base[siz];
int get_hash(string s)
{
    int ret = 0;
    for(int i = 0;i<s.size();i++)
    {
        ret+=s[i]*base[i]; ret%=mod;
    }
    return ret;
}
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   base[0] = 1;
   for(int i = 1;i<siz;i++)  base[i] = (base[i-1]*A)%mod;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       ss.insert(get_hash(s));
   }
   while(m--)
   {
       string s; cin>>s;
       int cur = get_hash(s);
       int p = 0;
       for(int i = 0;i<s.size();i++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               int t = cur+(c-s[i])*base[i];
               t+=mod; t%=mod;
               if(ss.count(t)) p = 1;
           }
       }
       if(p) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1110111110111;
const int siz = 1000001;
set<ll>ss;
ll A = 11,n,m,base[siz];
ll get_hash(string s)
{
    ll ret = 0;
    for(int i = 0;i<s.size();i++)
    {
        ret+=s[i]*base[i]; ret%=mod;
    }
    return ret;
}
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   base[0] = 1;
   for(int i = 1;i<siz;i++)  base[i] = (base[i-1]*A)%mod;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       ss.insert(get_hash(s));
   }
   while(m--)
   {
       string s; cin>>s;
       ll cur = get_hash(s);
       int p = 0;
       for(int i = 0;i<s.size();i++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               ll t = cur+(c-s[i])*base[i];
               t+=mod; t%=mod;
               if(ss.count(t)) p = 1;
           }
       }
       if(p) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
const int siz = 3e5+5;
int n,m,a[siz];
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   cin>>n>>m;
   map<string,int>mp;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       for(int j = 0;j<s.size();j++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[j]) continue;
               string cur = s; cur[j] = c;
               mp[cur] = 1;
           }
       }
   }
   while(m--)
   {
       string s; cin>>s;
       if(mp[s]) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include<bits/stdc++.h>
#define pb push_back
#define bug(x) cout<<x<<endl
using namespace std;
typedef long long ll;
const ll A = 11,mod = 1110111110111,siz = 1000001;
set<ll>S;
ll n,m,base[siz];
ll get_hash(string s)
{
    ll ret = 0;
    for(int i = 0;i<s.size();i++)
    {
        ret+=s[i]*base[i]; ret%=mod;
    }
    return ret;
}
int32_t main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);

   base[0] = 1;
   for(int i = 1;i<siz;i++)  base[i] = (base[i-1]*A)%mod;
   cin>>n>>m;
   for(int i = 1;i<=n;i++)
   {
       string s; cin>>s;
       S.insert(get_hash(s));
   }
   while(m--)
   {
       string s; cin>>s;
       ll cur = get_hash(s);
       int p = 0;
       for(int i = 0;i<s.size();i++)
       {
           for(char c = 'a';c<='c';c++)
           {
               if(c == s[i]) continue;
               ll t = cur+(c-s[i])*base[i];
               t+=4*mod; t%=mod;
               if(S.count(t)) p = 1;
           }
       }
       if(p) cout<<"YES\n";
       else cout<<"NO\n";
   }

}


#include <bits/stdc++.h>
#define int long long
#define FOR(i,a,b) for(int i=a; i<b; i++)
using namespace std;
const int N = 1000001, A = 11, MOD =  1110111110111;
int n, m, base[N];
set<int> S;
string t;
int get_hash(string s){
	int ret = 0;
	FOR(i,0,s.size()){
		ret += s[i]*base[i];
		ret %= MOD;
	}
	return ret;
}
int32_t main(){
	base[0] = 1;
	FOR(i,1,N)
		base[i] = base[i-1]*A % MOD;
	cin>>n>>m;
	while(n--){
		cin>>t;
		S.insert(get_hash(t));
	}
	while(m--){
		bool ok = 0;
		cin>>t;
		int h = get_hash(t);
		FOR(i,0,t.size())
			FOR(j,'a','d')
				if(j != t[i])
					ok |= S.count((h+(j-t[i])*base[i]+4*MOD)%MOD);
		cout<<(ok ? "YES\n":"NO\n");
	}
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			if(c != 'a'){
				s[i] = 'a';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%10 == 0)mp.erase(s);
			}
			if(c != 'b' ){
				s[i] = 'b';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%10 == 0)mp.erase(s);
			}
			if(c != 'c' ){
				s[i] = 'c';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%10 == 0)mp.erase(s);
			}
			s[i] = c;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		/*s = "";
		for(int l = 0 ; l < 1000 ; l++){
			c = 'a' + rand()%3 ;
			s += c;
		}*/
		for(int j = 0 ; j <s.size() ; j++){
			c = s[j];
			for(char d = 'a' ; d<'d' ; d++){
				if(d == c) continue;
				s[j] = d;
				mp[s] = 1;
			}
			s[j] = c;
		}
	}

	while(m--){
		cin >> s;
		/*s = "";
		for(int l = 0 ; l < 1000 ; l++){
			c = 'a' + rand()%3 ;
			s += c;
		}*/
		if(mp[s] == 1){
			cout << "YES" << endl;
		}else{
			mp[s] = 0;
			cout << "NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

set< ll > S;
string s;

const ll p = 9091;

ll go(string s, bool ret) {
	ll t = 0; int n = s.size(); ll pp = 1, h = 0;
	for (int i = 0; i < n; i++) {
		ll c = s[i] - 'a' + 1;
		h = (h + pp*c) % md; pp = (pp * p)%md;
	}

	pp = 1;
	if (ret) return h;

	for (int i = 0; i < n; i++) {
		ll c = s[i] - 'a' + 1;
		for (int d = 1; d <= 3; d++) {
			if (c == d) continue;
			ll hp = (h - (c * pp)%md + d * pp + md) % md;
			S.insert(hp);
		}
		pp = (pp * p) % md;
	}
	return 0;
}

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> s;
		go(s, false);
	}

	while (m--) {
		cin >> s; ll z = go(s, true);
		cout << ((S.count(z) > 0) ? "YES" : "NO") << endl;
	}
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(2836263499ll)
#define pb push_back

set< ll > S;
string s;

const ll p = 9091;

ll go(string s, bool ret) {
	ll t = 0; int n = s.size(); ll pp = 1, h = 0;
	for (int i = 0; i < n; i++) {
		ll c = s[i] - 'a' + 1;
		h = (h + pp*c) % md; pp = (pp * p)%md;
	}

	pp = 1;
	if (ret) return h;

	for (int i = 0; i < n; i++) {
		ll c = s[i] - 'a' + 1;
		for (int d = 1; d <= 3; d++) {
			if (c == d) continue;
			ll hp = (h - (c * pp)%md + d * pp + md) % md;
			S.insert(hp);
		}
		pp = (pp * p) % md;
	}
	return 0;
}

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> s;
		go(s, false);
	}

	while (m--) {
		cin >> s; ll z = go(s, true);
		cout << ((S.count(z) > 0) ? "YES" : "NO") << endl;
	}
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			if(c != 'a'){
				s[i] = 'a';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%3 == 0)mp.erase(s);
			}
			if(c != 'b' ){
				s[i] = 'b';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%3 == 0)mp.erase(s);
			}
			if(c != 'c' ){
				s[i] = 'c';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%3 == 0)mp.erase(s);
			}
			s[i] = c;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		/*s = "";
		for(int l = 0 ; l < 1000 ; l++){
			c = 'a' + rand()%3 ;
			s += c;
		}*/
		mp[s] = 1;
		for(int j = 0 ; j <s.size() ; j++){
			c = s[j];
			for(char d = 'a' ; d<'d' ; d++){
				if(d == c) continue;
				s[j] = d;
				mp[s] = 1;
			}
			s[j] = c;
		}
	}

	while(m--){
		cin >> s;
		/*s = "";
		for(int l = 0 ; l < 1000 ; l++){
			c = 'a' + rand()%3 ;
			s += c;
		}*/
		if(mp[s] == 1){
			cout << "YES" << endl;
		}else{
			mp[s] = 0;
			cout << "NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

unordered_map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			for(int d = 'a' ; d<='c' ; d++){
				if(c == d) continue;
				s[i] = d;
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				mp.erase(s);
			}
			s[i] = c;
			if(y) break;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

set< ll > S;
string s;

const ll p = 9091;

ll go(string s, bool ret) {
	ll t = 0; int n = s.size(); ll pp = 1, h = 0;
	for (int i = 0; i < n; i++) {
		int c = s[i] - 'a';
		h = (h + pp*c) % md; pp = (pp * p)%md;
	}

	pp = 1;
	if (ret) return h;

	for (int i = 0; i < n; i++) {
		int c = s[i] - 'a';
		for (int d = 0; d < 3; d++) {
			if (c == d) continue;
			ll hp = (h - c * pp + d * pp + md) % md;
			S.insert(hp);
		}
		pp = (pp * p) % md;
	}
	return 0;
}

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> s;
		go(s, false);
	}

	while (m--) {
		cin >> s; ll z = go(s, true);
		cout << ((S.count(z) > 0) ? "YES" : "NO") << endl;
	}
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			if(c != 'a'){
				s[i] = 'a';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%50 == 0)mp.erase(s);
			}
			if(c != 'b' ){
				s[i] = 'b';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%50 == 0)mp.erase(s);
			}
			if(c != 'c' ){
				s[i] = 'c';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%50 == 0)mp.erase(s);
			}
			s[i] = c;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			if(c != 'a'){
				s[i] = 'a';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				mp.erase(s);
			}
			if(c != 'b' ){
				s[i] = 'b';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				mp.erase(s);
			}
			if(c != 'c' ){
				s[i] = 'c';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				mp.erase(s);
			}
			s[i] = c;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		/*s = "";
		for(int l = 0 ; l < 1000 ; l++){
			c = 'a' + rand()%3 ;
			s += c;
		}*/
		mp[s] = 1;
		for(int j = 0 ; j <s.size() ; j++){
			c = s[j];
			for(char d = 'a' ; d<'d' ; d++){
				if(d == c) continue;
				s[j] = d;
				mp[s] = 1;
			}
			s[j] = c;
		}
	}

	while(m--){
		cin >> s;
		/*s = "";
		for(int l = 0 ; l < 1000 ; l++){
			c = 'a' + rand()%3 ;
			s += c;
		}*/
		if(mp[s] == 1){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

vector < string > v;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		v.pb(s);
	}
	sort(v.begin() , v.end());
	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			if(c != 'a'){
				s[i] = 'a';
				if(binary_search(v.begin() , v.end() , s) == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
			}
			if(c != 'b' ){
				s[i] = 'b';
				if(binary_search(v.begin() , v.end() , s)  == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
			}
			if(c != 'c' ){
				s[i] = 'c';
				if(binary_search(v.begin() , v.end() , s) == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
			}
			s[i] = c;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			if(c != 'a'){
				s[i] = 'a';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(!(i%10 ==  0))mp.erase(s);
			}
			if(c != 'b' ){
				s[i] = 'b';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(!(i%10 ==  0))mp.erase(s);
			}
			if(c != 'c' ){
				s[i] = 'c';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(!(i%10 ==  0))mp.erase(s);
			}
			s[i] = c;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(2836263499ll)
#define md2 ll(1000000009ll)
#define pb push_back

set< pair<ll, ll> > S;
string s;

const ll p = 9091;
const ll p2 = 317;

pair<ll, ll> go(string s, bool ret) {
	ll t = 0; int n = s.size(); ll pp = 1, pp2 = 1, h = 0, h2 = 0;
	for (int i = 0; i < n; i++) {
		ll c = s[i] - 'a' + 1;
		h2 = (h2 + pp2*c) % md2; pp2 = (pp2 * p2)%md2;
		h = (h + pp*c) % md; pp = (pp * p)%md;
	}

	pp = pp2 = 1;
	if (ret) return {h, h2};

	for (int i = 0; i < n; i++) {
		ll c = s[i] - 'a' + 1;
		for (int d = 1; d <= 3; d++) {
			if (c == d) continue;
			ll hp = (h - (c * pp)%md + d * pp + md) % md;
			ll hp2 = (h2 - (c * pp2)%md2 + d * pp2 + md2) % md2;
			S.insert({hp, hp2});
		}
		pp = (pp * p) % md;
		pp2 = (pp2 * p2) % md2;
	}
	return {0ll, 0ll};
}

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> s;
		go(s, false);
	}

	while (m--) {
		cin >> s; auto z = go(s, true);
		cout << ((S.count(z) > 0) ? "YES" : "NO") << endl;
	}
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			if(c != 'a'){
				s[i] = 'a';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(!(i%100 ==  0))mp.erase(s);
			}
			if(c != 'b' ){
				s[i] = 'b';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(!(i%100 ==  0))mp.erase(s);
			}
			if(c != 'c' ){
				s[i] = 'c';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(!(i%100 ==  0))mp.erase(s);
			}
			s[i] = c;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			if(c != 'a'){
				s[i] = 'a';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%2 == 0)mp.erase(s);
			}
			if(c != 'b' ){
				s[i] = 'b';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%2 == 0)mp.erase(s);
			}
			if(c != 'c' ){
				s[i] = 'c';
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				if(i%2 == 0)mp.erase(s);
			}
			s[i] = c;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			for(int d = 'a' ; d<='c' ; d++){
				if(c == d) continue;
				s[i] = d;
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				mp.erase(s);
			}
			s[i] = c;
			if(y) break;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			for(int d = 'a' ; d<='c' ; d++){
				if(c == d) continue;
				s[i] = d;
				if(mp[s] == 1){
					cout << "YES" << endl;
					mp.erase(s);
					y = 1;
					break;
				}
				mp.erase(s);
			}
			s[i] = c;
			if(y) break;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 1000005
#define md ll(1000000007)
#define pb push_back

map < string , ll > mp;
string s;

int main(){

	ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n = 0, m = 0, k = 0, q = 0, ans = 0;
	ll x = 0, y = 0, t = 0, sum = 0, sz = 0;

	cin >> n >> m ;
	char c;
	for(int i = 0 ; i <n ; i++){
		cin >> s;
		mp[s] = 1;
	}

	while(m--){
		cin >> s;
		y = 0;
		for(int i = 0 ; i <s.size() ; i++){
			c = s[i];
			for(int d = 'a' ; d<='c' ; d++){
				if(c == d) continue;
				s[i] = d;
				if(mp[s] == 1){
					cout << "YES" << endl;
					y = 1;
					break;
				}
				//mp.erase(s);
			}
			s[i] = c;
			if(y) break;
		}
		if(y == 0) {
			cout <<"NO" << endl;
		}
	}

	return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1110111110111ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res + (j+97 - s[i])*temp[i] +4*mod))%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	temp[0] = 1;
	for(int i=1;i<N-1;i++){
		temp[i] = (temp[i-1]*11)%mod;
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1000000007ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 3e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res%mod-(s[i]*temp[i])%mod+mod)%mod+((j+97)*temp[i])%mod)%mod;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	for(int i=0;i<N-1;i++){
		temp[i] = poww(37,i,mod);
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1110111110111ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = (res + (j+97 - s[i])*temp[i] +4*mod)%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	temp[0] = 1;
	for(int i=1;i<N-1;i++){
		temp[i] = poww(11,i,mod);
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1110111110111ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = (res + (j+97 - s[i])*temp[i] +4*mod)%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	temp[0] = 1;
	for(int i=1;i<N-1;i++){
		temp[i] = (temp[i-1]*11)%mod ;
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1110111110111
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 3e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = (res + (j+97 - s[i])*temp[i] +4*mod)%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	for(int i=0;i<N-1;i++){
		temp[i] = poww(11,i,mod);
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1110111110111ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res - s[i]*temp[i] +mod)%mod+((j+97)*temp[i])%mod)%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	temp[0] = 1;
	for(int i=1;i<N-1;i++){
		temp[i] = (temp[i-1]*11)%mod;
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1110111110111ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res - s[i]*temp[i] +3*mod)%mod+((j+97)*temp[i])%mod)%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	temp[0] = 1;
	for(int i=1;i<N-1;i++){
		temp[i] = (temp[i-1]*11)%mod;
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1000000007ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N],temp2[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res + (j+97 - s[i])*temp[i] +4*mod))%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	temp[0] = 1;
	for(int i=1;i<N-1;i++){
		temp[i] = (temp[i-1]*11)%mod;
	}
	// for(int i=0;i<40;i++)temp2[i] = poww(11,i,mod)%mod; ;
	// for(int i=0;i<30;i++)cout <<temp[i] <<' ';
	// cout <<'\n';
	// for(int i=0;i<30;i++)cout << temp2[i] <<' ';
	// cout << '\n' ;
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1000000007ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 3e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res%mod-(s[i]*temp[i])%mod+5*mod)%mod+((j+97)*temp[i])%mod)%mod;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	for(int i=0;i<N-1;i++){
		temp[i] = poww(7,i,mod);
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1110111110111ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res - s[i]*temp[i] +4*mod)%mod+((j+97)*temp[i])%mod)%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	temp[0] = 1;
	for(int i=1;i<N-1;i++){
		temp[i] = (temp[i-1]*11)%mod;
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              32416189381ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N],temp2[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res + (j+97 - s[i])*temp[i] +4*mod))%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	temp[0] = 1;
	for(int i=1;i<N-1;i++){
		temp[i] = (temp[i-1]*11)%mod;
	}
	// for(int i=0;i<40;i++)temp2[i] = poww(11,i,mod)%mod; ;
	// for(int i=0;i<30;i++)cout <<temp[i] <<' ';
	// cout <<'\n';
	// for(int i=0;i<30;i++)cout << temp2[i] <<' ';
	// cout << '\n' ;
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1110111110111
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 3e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res += s[i]*temp[i] ;
		res %= mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = (res + (j+97 - s[i])*temp[i] +4*mod)%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	for(int i=0;i<N-1;i++){
		temp[i] = poww(11,i,mod);
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1000000007ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 3e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = (res + (j+97 - s[i])*temp[i] +4*mod)%mod ;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	for(int i=0;i<N-1;i++){
		temp[i] = poww(11,i,mod);
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1000000007ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 3e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res%mod-(s[i]*temp[i])%mod+mod)%mod+((j+97)*temp[i])%mod)%mod;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	for(int i=0;i<N-1;i++){
		temp[i] = poww(7,i,mod);
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1000000007ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 3e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

// void insert(string &s){
// 	int len = s.length() ;
// 	int v = root ;
// 	for(int i=0;i<len;i++){
// 		int c = s[i]-'a' ;
// 		if(tri[v][c]==0) tri[v][c] = newNode();
// 		v = tri[v][c] ;
// 	}
// }
ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res%mod-(s[i]*temp[i])%mod+mod)%mod+((j+97)*temp[i])%mod)%mod;
			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	for(int i=0;i<N-1;i++){
		temp[i] = poww(37,i,mod);
	}
	// for(int i=0;i<10;i++)cout << temp[i] <<" ";
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		// insert(s);
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include "Templates.cpp"          ... it works bro ...seamlessly....

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,long long > > vpi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define ft               first
#define sd               second
#define sf1(c)           scanf("%d",&c)
#define pf(c)            printf("%d ",c)
#define pof              pop_front
#define pob              pop_back
#define sz(a)            int((a).size())
#define pb               push_back
#define lc(i)            ((2*(i) + 1))
#define rc(i)            ((2*(i) +2))
#define all(c)           (c).begin(),(c).end()
#define present(c,x)     ((c).find(x) != (c).end())
#define cpresent(c,x)    (find(all(c),x) != (c).end())
#define rep(i,a,b)       for(int i=int(a);i<=int(b);i++)
#define mp               make_pair
#define ms(a,b)          memset(a,b,sizeof a)
#define mod              1000000007ll
#define hot              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err2(x,y)		 cout<<#x"="<<x<<" "#y"="<<y<<endl
#define err3(x,y,z) 	 cout<<#x"="<<x<<" "#y"="<<y<<" "#z"="<<z<<endl

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int N = 6e5+20;
ll poww(ll a,ll b,ll m)
{
	if(b==0)return 1ll;
      if(b==1)return a%m;
      ll ans = poww(a,b/2,m);
	ans = ((ans%m)*(ans%m))%m;
	if(b%2==1) ans = (ans*a)%m;
	return ans%m;
}

inline bool overflows(ll a, ll b) {
  return a > (LLONG_MAX / b);
}
bool cmp(pair<int,int> a,pair<int,int > b){
	if(a.ft == b.ft)return a.sd < b.sd;
	return a.ft < b.ft ;
}
// https://www.journaldev.com/1162/java-multithreading-concurrency-interview-questions-answers
// https://dzone.com/articles/threads-top-80-interview

ll loc ;
int size = 0;

// http://aofa.cs.princeton.edu/30gf/
int newNode(){
	return ++size;
}

// int tri[N][3] ;
int root = 0,n,k;
bool win[N] , loose[N] ;
set<ll> hashes;

ll temp[N] ;
void solve(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	hashes.insert(res) ;
}
bool query(string &s){
	ll res = 0;
	for(int i=0;i<s.length();i++){
		res = (res%mod + (s[i]*temp[i])%mod)%mod ;
	}
	// cout << res << '\n' ;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<=2;j++){
			if(s[i]==j+97)continue;
			ll tt = ((res%mod-(s[i]*temp[i])%mod+5*mod)%mod+((j+97)*temp[i])%mod)%mod;

			if(hashes.find(tt)!=hashes.end())
			{
				return true ;
			}
		}
	}
	return false ;

}
void pre(){
	for(int i=0;i<N-1;i++){
		temp[i] = poww(7,i,mod);
	}
}
int main(){
	cin >> n >> k ;
	pre();

	while(n--){
		string s;
		cin >> s;
		solve(s) ;
	}
	while(k--){
		string s;
		cin >> s;
		cout <<(query(s)?"YES\n":"NO\n");
	}
	return 0;
}
/// sudo service network-manager restart   .... wifi will work

// number of solutions for x1+x2+...+xr = n
//    when xi >=0  ,   = C(n+r-1,r-1) ;
//	when xi > 0  ,   = C(n-1,r-1) ;
//   star and bars wiki.....

// https://www.geeksforgeeks.org/queries-find-distance-two-nodes-binary-tree-ologn-method/

// https://www.geeksforgeeks.org/find-all-shortest-unique-prefixes-to-represent-each-word-in-a-given-list/


#include<bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define sc(n) scanf("%lld", &n)
#include <bits/stdc++.h>
using namespace std;

const long long ALPHABET_SIZE = 3;

// trie node
struct TrieNode{
    TrieNode *children[ALPHABET_SIZE];
    bool isEndOfWord;
};

TrieNode *getNode(void){
	TrieNode *pNode =  new TrieNode;
	pNode->isEndOfWord = false;
	long long i;
	for (i = 0; i < ALPHABET_SIZE; i++){
		pNode->children[i] = NULL;
	}
	return pNode;
}

void insert(TrieNode *root, string key){
	TrieNode *pCrawl = root;
	long long i;
	for (i = 0; i < key.length(); i++){
		long long index = key[i] - 'a';
		if (!pCrawl->children[index]){
			pCrawl->children[index] = getNode();
		}
		pCrawl = pCrawl->children[index];
	}
	pCrawl->isEndOfWord = true;
}
bool flag=false;
void search(TrieNode *root, string key,long long cnt,long long j){
	long long i;
	if(root==NULL){
		return;
	}
	if(j==key.size() && root->isEndOfWord){
		flag=true;
		return;
	}
	for(i=0;i<2;i++){
		if(key[j]==('a'+i) && root->children[i]!=NULL){
			search(root->children[i],key,cnt,j+1);
		}
		else if(cnt==0 && root->children[i]!=NULL){
			search(root->children[i],key,cnt+1,j+1);
		}
		else{
			return;
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n,m,i,j;
	string s;
	cin>>n>>m;
	TrieNode *root = getNode();
	for(i=0;i<n;i++){
		cin>>s;
		insert(root,s);
	}
	for(i=0;i<m;i++){
		cin>>s;
		flag=false;
		TrieNode *p=root;
		search(p,s,0LL,0LL);
		(flag)?cout<<"YES\n":cout<<"NO\n";
		//search(root,s)?cout<<"YES\n":cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ft first
 #define sd second
 #define pb push_back
 #define mp make_pair
  #define sc(n) scanf("%lld", &n)
  const long long ALPHABET_SIZE = 3; // trie node
 struct TrieNode{ TrieNode *children[ALPHABET_SIZE]; bool isEndOfWord; }; TrieNode *getNode(void){ 	TrieNode *pNode = new TrieNode; 	pNode->isEndOfWord = false; 	long long i; 	for (i = 0; i < ALPHABET_SIZE; i++){ 		pNode->children[i] = NULL; 	} 	return pNode; } void insert(TrieNode *root, string key){ 	TrieNode *pCrawl = root; 	long long i; 	for (i = 0; i < key.length(); i++){ 		long long index = key[i] - 'a'; 		if (!pCrawl->children[index]){ 			pCrawl->children[index] = getNode(); 		} 		pCrawl = pCrawl->children[index]; 	} 	pCrawl->isEndOfWord = true; } bool flag=false; void search(TrieNode *root, string key,long long cnt,long long j){ 	long long i; 	if(root==NULL){ 		return; 	} 	if(j==key.size()){ if(root->isEndOfWord && cnt<=1){ 		flag=true; }		return;  }	for(i=0;i<3 && !flag;i++){ 		if(key[j]==('a'+i)){ 			search(root->children[i],key,cnt,j+1); 		} 		else if(cnt==0){ 			search(root->children[i],key,cnt+1,j+1); 		} 	} } int main(){ 	ios_base::sync_with_stdio(false); 	cin.tie(0); 	cout.tie(0); 	long long n,m,i,j; 	string s; 	cin>>n>>m; 	TrieNode *root = getNode(); 	for(i=0;i<n;i++){ 		cin>>s; 		insert(root,s); 	} 	for(i=0;i<m;i++){ 		cin>>s; 		flag=false; 		TrieNode *p=root; 		search(p,s,0LL,0LL); 		(flag)?cout<<"YES\n":cout<<"NO\n"; 		//search(root,s)?cout<<"YES\n":cout<<"NO\n"; 	} 	return 0; }


#include<bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define sc(n) scanf("%lld", &n)
#include <bits/stdc++.h>
using namespace std;

const long long ALPHABET_SIZE = 3;

// trie node
struct TrieNode{
    TrieNode *children[ALPHABET_SIZE];
    bool isEndOfWord;
};

TrieNode *getNode(void){
	TrieNode *pNode =  new TrieNode;
	pNode->isEndOfWord = false;
	long long i;
	for (i = 0; i < ALPHABET_SIZE; i++){
		pNode->children[i] = NULL;
	}
	return pNode;
}

void insert(TrieNode *root, string key){
	TrieNode *pCrawl = root;
	long long i;
	for (i = 0; i < key.length(); i++){
		long long index = key[i] - 'a';
		if (!pCrawl->children[index]){
			pCrawl->children[index] = getNode();
		}
		pCrawl = pCrawl->children[index];
	}
	pCrawl->isEndOfWord = true;
}
bool flag=false;
void search(TrieNode *root, string key,long long cnt,long long j){
	long long i;
	if(root==NULL){
		return;
	}
	if(j==key.size() && root->isEndOfWord){
		flag=true;
		return;
	}
	for(i=0;i<3 && !flag;i++){
		if(key[j]==('a'+i)){
			search(root->children[i],key,cnt,j+1);
		}
		else if(cnt==0){
			search(root->children[i],key,cnt+1,j+1);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n,m,i,j;
	string s;
	cin>>n>>m;
	TrieNode *root = getNode();
	for(i=0;i<n;i++){
		cin>>s;
		insert(root,s);
	}
	for(i=0;i<m;i++){
		cin>>s;
		flag=false;
		TrieNode *p=root;
		search(p,s,0LL,0LL);
		(flag)?cout<<"YES\n":cout<<"NO\n";
		//search(root,s)?cout<<"YES\n":cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define sc(n) scanf("%lld", &n)
#include <bits/stdc++.h>
using namespace std;

const long long ALPHABET_SIZE = 3;

// trie node
struct TrieNode{
    TrieNode *children[ALPHABET_SIZE];
    bool isEndOfWord;
};

TrieNode *getNode(void){
	TrieNode *pNode =  new TrieNode;
	pNode->isEndOfWord = false;
	long long i;
	for (i = 0; i < ALPHABET_SIZE; i++){
		pNode->children[i] = NULL;
	}
	return pNode;
}

void insert(TrieNode *root, string key){
	TrieNode *pCrawl = root;
	long long i;
	for (i = 0; i < key.length(); i++){
		long long index = key[i] - 'a';
		if (!pCrawl->children[index]){
			pCrawl->children[index] = getNode();
		}
		pCrawl = pCrawl->children[index];
	}
	pCrawl->isEndOfWord = true;
}
bool flag=false;
string key;
void search(TrieNode *root,long long cnt,long long j){
	long long i;
	if(root==NULL){
		return;
	}
	if(j==key.size()){
		if(root->isEndOfWord && cnt==1){
			flag=true;
		}
		return;
	}
	for(i=0;i<3 && !flag;i++){
		if(key[j]==('a'+i)){
			search(root->children[i],cnt,j+1);
		}
		else if(cnt==0){
			search(root->children[i],cnt+1,j+1);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n,m,i,j;
	string s;
	cin>>n>>m;
	TrieNode *root = getNode();
	for(i=0;i<n;i++){
		cin>>s;
		insert(root,s);
	}
	for(i=0;i<m;i++){
		cin>>s;
		flag=false;
		TrieNode *p=root;
		key=s;
		search(p,0LL,0LL);
		(flag)?cout<<"YES\n":cout<<"NO\n";
		//search(root,s)?cout<<"YES\n":cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define sc(n) scanf("%lld", &n)
#include <bits/stdc++.h>
using namespace std;

const long long ALPHABET_SIZE = 3;

// trie node
struct TrieNode{
    TrieNode *children[ALPHABET_SIZE];
    bool isEndOfWord;
};

TrieNode *getNode(void){
	TrieNode *pNode =  new TrieNode;
	pNode->isEndOfWord = false;
	long long i;
	for (i = 0; i < ALPHABET_SIZE; i++){
		pNode->children[i] = NULL;
	}
	return pNode;
}

void insert(TrieNode *root, string key){
	TrieNode *pCrawl = root;
	long long i;
	for (i = 0; i < key.length(); i++){
		long long index = key[i] - 'a';
		if (!pCrawl->children[index]){
			pCrawl->children[index] = getNode();
		}
		pCrawl = pCrawl->children[index];
	}
	pCrawl->isEndOfWord = true;
}
bool flag=false;
void search(TrieNode *root, string key,long long cnt,long long j){
	long long i;
	if(root==NULL){
		return;
	}
	if(j==key.size() && root->isEndOfWord){
		flag=true;
		return;
	}
	for(i=0;i<3;i++){
		if(key[j]==('a'+i) && root->children[i]!=NULL){
			search(root->children[i],key,cnt,j+1);
		}
		else if(cnt==0 && root->children[i]!=NULL){
			search(root->children[i],key,cnt+1,j+1);
		}
		else{
			return;
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n,m,i,j;
	string s;
	cin>>n>>m;
	TrieNode *root = getNode();
	for(i=0;i<n;i++){
		cin>>s;
		insert(root,s);
	}
	for(i=0;i<m;i++){
		cin>>s;
		flag=false;
		TrieNode *p=root;
		search(p,s,0LL,0LL);
		(flag)?cout<<"YES\n":cout<<"NO\n";
		//search(root,s)?cout<<"YES\n":cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define sc(n) scanf("%lld", &n)

const long long ALPHABET_SIZE = 3;

// trie node
struct TrieNode{
    TrieNode *children[ALPHABET_SIZE];
    bool isEndOfWord;
};

TrieNode *getNode(void){
	TrieNode *pNode =  new TrieNode;
	pNode->isEndOfWord = false;
	long long i;
	for (i = 0; i < ALPHABET_SIZE; i++){
		pNode->children[i] = NULL;
	}
	return pNode;
}

void insert(TrieNode *root, string key){
	TrieNode *pCrawl = root;
	long long i;
	for (i = 0; i < key.length(); i++){
		long long index = key[i] - 'a';
		if (!pCrawl->children[index]){
			pCrawl->children[index] = getNode();
		}
		pCrawl = pCrawl->children[index];
	}
	pCrawl->isEndOfWord = true;
}
bool flag=false;
void search(TrieNode *root, string key,long long cnt,long long j){
	long long i;
	if(root==NULL){
		return;
	}
	if(j==key.size()){ if(root->isEndOfWord && cnt<=1){
		flag=true;}
		return;
	}
	for(i=0;i<3 && !flag;i++){
		if(key[j]==('a'+i)){
			search(root->children[i],key,cnt,j+1);
		}
		else if(cnt==0){
			search(root->children[i],key,cnt+1,j+1);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n,m,i,j;
	string s;
	cin>>n>>m;
	TrieNode *root = getNode();
	for(i=0;i<n;i++){
		cin>>s;
		insert(root,s);
	}
	for(i=0;i<m;i++){
		cin>>s;
		flag=false;
		TrieNode *p=root;
		search(p,s,0LL,0LL);
		(flag)?cout<<"YES\n":cout<<"NO\n";
		//search(root,s)?cout<<"YES\n":cout<<"NO\n";
	}
	return 0;
}


e<bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define sc(n) scanf("%lld", &n)

const long long ALPHABET_SIZE = 3;

// trie node
struct TrieNode{
    TrieNode *children[ALPHABET_SIZE];
    bool isEndOfWord;
};

TrieNode *getNode(void){
	TrieNode *pNode =  new TrieNode;
	pNode->isEndOfWord = false;
	long long i;
	for (i = 0; i < ALPHABET_SIZE; i++){
		pNode->children[i] = NULL;
	}
	return pNode;
}

void insert(TrieNode *root, string key){
	TrieNode *pCrawl = root;
	long long i;
	for (i = 0; i < key.length(); i++){
		long long index = key[i] - 'a';
		if (!pCrawl->children[index]){
			pCrawl->children[index] = getNode();
		}
		pCrawl = pCrawl->children[index];
	}
	pCrawl->isEndOfWord = true;
}
bool flag=false;
void search(TrieNode *root, string key,long long cnt,long long j){
	long long i;
	if(root==NULL){
		return;
	}
	if(j==key.size()){ if(root->isEndOfWord && cnt<=1){
		flag=true;}
		return;
	}
	for(i=0;i<3 && !flag;i++){
		if(key[j]==('a'+i)){
			search(root->children[i],key,cnt,j+1);
		}
		else if(cnt==0){
			search(root->children[i],key,cnt+1,j+1);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n,m,i,j;
	string s;
	cin>>n>>m;
	TrieNode *root = getNode();
	for(i=0;i<n;i++){
		cin>>s;
		insert(root,s);
	}
	for(i=0;i<m;i++){
		cin>>s;
		flag=false;
		TrieNode *p=root;
		search(p,s,0LL,0LL);
		(flag)?cout<<"YES\n":cout<<"NO\n";
		//search(root,s)?cout<<"YES\n":cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ft first
#define sd secon
#define pb push_back
#define mp make_pair
#define sc(n) scanf("%lld", &n)
const long long ALPHABET_SIZE = 3;
// trie node
struct TrieNode{ TrieNode *children[ALPHABET_SIZE]; bool isEndOfWord; };
TrieNode *getNode(void){ 	TrieNode *pNode = new TrieNode; 	pNode->isEndOfWord = false; 	long long i; 	for (i = 0; i < ALPHABET_SIZE; i++){ 		pNode->children[i] = NULL; 	} 	return pNode; }
void insert(TrieNode *root, string key){ 	TrieNode *pCrawl = root; 	long long i; 	for (i = 0; i < key.length(); i++){ 		long long index = key[i] - 'a'; 		if (!pCrawl->children[index]){ 			pCrawl->children[index] = getNode(); 		} 		pCrawl = pCrawl->children[index]; 	} 	pCrawl->isEndOfWord = true; }
bool flag=false
void search(TrieNode *root, string key,long long cnt,long long j){ 	long long i; 	if(root==NULL){ 		return; 	} 	if(j==key.size()){ if(root->isEndOfWord && cnt<=1){ 		flag=true; }		return;  }	for(i=0;i<3 && !flag;i++){ 		if(key[j]==('a'+i)){ 			search(root->children[i],key,cnt,j+1); 		} 		else if(cnt==0){ 			search(root->children[i],key,cnt+1,j+1); 		} 	} } int main(){ 	ios_base::sync_with_stdio(false); 	cin.tie(0); 	cout.tie(0); 	long long n,m,i,j; 	string s; 	cin>>n>>m; 	TrieNode *root = getNode(); 	for(i=0;i<n;i++){ 		cin>>s; 		insert(root,s); 	} 	for(i=0;i<m;i++){ 		cin>>s; 		flag=false; 		TrieNode *p=root; 		search(p,s,0LL,0LL); 		(flag)?cout<<"YES\n":cout<<"NO\n"; 		//search(root,s)?cout<<"YES\n":cout<<"NO\n"; 	} 	return 0; }


#include<bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define sc(n) scanf("%lld", &n)
#include <bits/stdc++.h>
using namespace std;

const long long ALPHABET_SIZE = 3;

// trie node
struct TrieNode{
    TrieNode *children[ALPHABET_SIZE];
    bool isEndOfWord;
};

TrieNode *getNode(void){
	TrieNode *pNode =  new TrieNode;
	pNode->isEndOfWord = false;
	long long i;
	for (i = 0; i < ALPHABET_SIZE; i++){
		pNode->children[i] = NULL;
	}
	return pNode;
}

void insert(TrieNode *root, string key){
	TrieNode *pCrawl = root;
	long long i;
	for (i = 0; i < key.length(); i++){
		long long index = key[i] - 'a';
		if (!pCrawl->children[index]){
			pCrawl->children[index] = getNode();
		}
		pCrawl = pCrawl->children[index];
	}
	pCrawl->isEndOfWord = true;
}
bool flag=false;
void search(TrieNode *root, string key,long long cnt,long long j){
	long long i;
	if(root==NULL){
		return;
	}
	if(j==key.size() && root->isEndOfWord && cnt<=1){
		flag=true;
		return;
	}
	for(i=0;i<3 && !flag;i++){
		if(key[j]==('a'+i)){
			search(root->children[i],key,cnt,j+1);
		}
		else if(cnt==0){
			search(root->children[i],key,cnt+1,j+1);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n,m,i,j;
	string s;
	cin>>n>>m;
	TrieNode *root = getNode();
	for(i=0;i<n;i++){
		cin>>s;
		insert(root,s);
	}
	for(i=0;i<m;i++){
		cin>>s;
		flag=false;
		TrieNode *p=root;
		search(p,s,0LL,0LL);
		(flag)?cout<<"YES\n":cout<<"NO\n";
		//search(root,s)?cout<<"YES\n":cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h> using namespace std; #define ft first #define sd second #define pb push_back #define mp make_pair #define sc(n) scanf("%lld", &n) #include <bits/stdc++.h> using namespace std; const long long ALPHABET_SIZE = 3; // trie node struct TrieNode{ TrieNode *children[ALPHABET_SIZE]; bool isEndOfWord; }; TrieNode *getNode(void){ 	TrieNode *pNode = new TrieNode; 	pNode->isEndOfWord = false; 	long long i; 	for (i = 0; i < ALPHABET_SIZE; i++){ 		pNode->children[i] = NULL; 	} 	return pNode; } void insert(TrieNode *root, string key){ 	TrieNode *pCrawl = root; 	long long i; 	for (i = 0; i < key.length(); i++){ 		long long index = key[i] - 'a'; 		if (!pCrawl->children[index]){ 			pCrawl->children[index] = getNode(); 		} 		pCrawl = pCrawl->children[index]; 	} 	pCrawl->isEndOfWord = true; } bool flag=false; void search(TrieNode *root, string key,long long cnt,long long j){ 	long long i; 	if(root==NULL){ 		return; 	} 	if(j==key.size()){ if(root->isEndOfWord && cnt<=1){ 		flag=true; }		return;  }	for(i=0;i<3 && !flag;i++){ 		if(key[j]==('a'+i)){ 			search(root->children[i],key,cnt,j+1); 		} 		else if(cnt==0){ 			search(root->children[i],key,cnt+1,j+1); 		} 	} } int main(){ 	ios_base::sync_with_stdio(false); 	cin.tie(0); 	cout.tie(0); 	long long n,m,i,j; 	string s; 	cin>>n>>m; 	TrieNode *root = getNode(); 	for(i=0;i<n;i++){ 		cin>>s; 		insert(root,s); 	} 	for(i=0;i<m;i++){ 		cin>>s; 		flag=false; 		TrieNode *p=root; 		search(p,s,0LL,0LL); 		(flag)?cout<<"YES\n":cout<<"NO\n"; 		//search(root,s)?cout<<"YES\n":cout<<"NO\n"; 	} 	return 0; }