Help me in solving CORTSENT problem

My issue

explain code

My code

#include <iostream>
using namespace std;

int main() {
int t;
cin>>t;
while(t--){
    int k;
    cin>>k;
    bool b=true;
    for(int i=0;i<k;i++){
        string s;
        cin>>s;
       
        for(int j=0;j<s.length();j++){
            if(s[0]>='a'&&s[0]<='m'){
                if((s[j]<'a'||s[j]>'m')){
                     b=false;
                     break;
                 }
                 }else if((s[0]>='N'&&s[0]<='Z')){
                if(s[j]<'N'&&s[j]>'Z'){
                    b=false;
                    break;
                }
                }else{
                    b=false;
                    break;
                }
                    
                }
            
        if(!b){
            break;
        }
}
    
    
    
    if(b==false){
        cout<<"NO"<<endl;
    }else{
        cout<<"YES"<<endl;
    }
}

	return 0;
}

Problem Link: CORTSENT Problem - CodeChef

@jtender_007
What u have to do is to check each word of sentence and each word either contain lower case letters from a-m or upper case letters from N-Z . if a word contains a mixture then u have to print “NO” or in else case u have to print “YES”.