function Main(s){
  s = s.split("\n");
  var l = s[0].length;
  if(s[0] === s[1]){console.log("Yes");return;}
  for(var i = 0; i < l; i++){
    s[0] = s[0][l-1]+s[0].slice(0,-1);
    if(s[0] === s[1]){console.log("Yes");return;}
  }
  console.log("No");
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));