MODE = "stdio"
require 'matrix'
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = "\
  vanceknowledgetoad
  advanced
  ".split("\n")
  tmp.each{|s|
    line << s.strip
  }
end


s = line[0]*2

if s.include?(line[1])
  puts "Yes"
else
  puts "No" 
end