using namespace std; int main() { int t;cin>>t; cin.get(); while(t--){ int a,b;cin>>a>>b; string s1,s2; cin>>s1>>s2; s1=s1+s1; if(s1.find(s2)!=s1.npos&&a>=b){ cout<<"YES"<<endl; } else cout<<"NO"<<endl; } }
include