#include <iostream>
using namespace std;
int main() {
// your code goes here
string s1 = "abcd";
string s2 = "cdab";
bool s=true;
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
if(s1[i]!=s2[(j+1)%4]){
s=false;
break;
}
}
}
if(s){
cout<<"yes"<<"\n";
}else{
cout<<"no"<<"\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCglzdHJpbmcgczEgPSAiYWJjZCI7CiAgICBzdHJpbmcgczIgPSAiY2RhYiI7CiAgICBib29sIHM9dHJ1ZTsKICAgIGZvcihpbnQgaT0wO2k8NDtpKyspewogICAgCWZvcihpbnQgaj0wO2o8NDtqKyspewogICAgCQlpZihzMVtpXSE9czJbKGorMSklNF0pewogICAgCQkJcz1mYWxzZTsKICAgIAkJCWJyZWFrOwogICAgCQl9CiAgICAJfQogICAgfQogICAgaWYocyl7CiAgICAJY291dDw8InllcyI8PCJcbiI7CiAgICB9ZWxzZXsKICAgIAljb3V0PDwibm8iPDwiXG4iOwogICAgfQogICAgCglyZXR1cm4gMDsKfQ==