#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
int t, r, c, i, j, na, nl, ni, nz, nw, ne;
vector <string> v;
string str;
cin >> t;
while(t --)
{
cin >> r >> c;
v.clear();
na = nl = ni = nz = nw = ne = 0;
for(i = 1; i <= r; i ++)
{
cin >> str;
v.push_back(str);
}
for(i = 0; i < r; i ++)
{
str = v[i];
for(j = 0; j < c; j ++)
{
if(str[j] == 'A')
na ++;
else if(str[j] == 'L')
nl ++;
else if(str[j] == 'I')
ni ++;
else if(str[j] == 'Z')
nz ++;
else if(str[j] == 'W')
nw ++;
else if(str[j] == 'E')
ne ++;
}
}
if(na >= 1 && nl >= 4 && ni >= 1 && nz >= 2 && nw >= 1 && ne >= 1)
cout << "YES \n";
else
cout << "NO \n";
if(t != 0)
cin >> str;
}
return 0;
}