function Main(input) {
    rotate = str => str.slice(1) + str[0];
    f = false;
    input = input.split("\n");
    for (i = 0; i < input[0].length; i++)
        if ((input[0] = rotate(input[0])) == input[1]) {
            f = true;
            break;
        }
    console.log(f ? "Yes" : "No");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));