open Batteries
open Printf
let () =
  let s,t = Scanf.scanf "%s %s " (fun a b -> a,b) in
  let ss = s^s in
  let res =
    try (
      let _ = String.rfind ss t in true
    ) with _ -> false
  in
  Printf.printf "%s\n" @@
  if res then "Yes" else "No"
