function Main (input) {
  var inputs = input.split(/\s/g);
  var strLength = inputs[0].length;
  var baseStr = inputs[0];
  var isSuccess = false;
  for (var index = 0; index < strLength; index += 1) {
    var newStr = baseStr.charAt(strLength - 1) + baseStr.slice(0, strLength - 1);
    console.log(newStr);
    if (newStr === inputs[1]) {
      isSuccess = true;
    } else {
      baseStr = newStr;
    }
  }
  return console.log('%s',isSuccess ? 'Yes' : 'No');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
