//#include #include #include using namespace std; //using namespace atcoder; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; int main() { ll N,M; cin>>N>>M; rep(n,N){ string S; cin>>S; rep(m,M-3){ if(S.substr(m,4)=="LOVE"){ cout<<"YES"<