local a, b = io.read("*l", "*l")
local ok = true
for j = 0, #a - 1 do
  ok = true
  for i = 1, #a do
    local bi = i + j
    if #a < bi then bi = bi - #a end
    if a:sub(i, i) ~= b:sub(bi, bi) then ok = false break end
  end
  if ok then break end
end
print(ok and "Yes" or "No")
