
local a, b = io.read("*l"), io.read("*l")

local x = string.len(a)
local sum = 0

for i = 1, math.huge do

    if a == b then
        print("Yes")
        break
    else
        a = string.sub(a, -1) .. string.sub(a, 1, -2)
    end
    sum = sum + 1
    if sum == x then
        print("No")
        break
    end

end