open Printf open Scanf
module MyInt = struct
	let (+) = (+) let (-) = (-) let (/) = (/) let ( * ) = ( * ) let (mod) = (mod) let (%) = (mod) let (+=) r v = r := !r + v let (-=) r v = r := !r - v let ( *=) r v= r := !r * v let (/=) r v = r := !r / v
	(* let input_int_array n = Array.init n (fun _ -> Scanf.scanf " %d" (fun v -> v))	
	let get_int () = Scanf.scanf " %d" (fun v -> v)
	let get_2_ints () = Scanf.scanf " %d %d" (fun u v -> u,v)
	let get_3_ints () = Scanf.scanf " %d %d %d" (fun u v w -> u,v,w)
	let get_4_ints () = Scanf.scanf " %d %d %d %d" (fun u v w x -> u,v,w,x)
	let get_5_ints () = Scanf.scanf " %d %d %d %d %d" (fun u v w x y -> u,v,w,x,y)
	let print_int_endline n = n |> string_of_int |> print_endline *)
end
let char_list_of_string str = 
	let rec f0 i a =
		if i<0 then a else f0 (i-1) (str.[i]::a)
	in f0 (String.length str - 1) []
let string_of_list ?(separator=" ") f ls =
	let rec f0 a s = match a with
		| [] -> s
		| [h] -> s ^ (f h) ^ separator
		| h::t -> f0 t (s ^ (f h) ^ separator)
	in f0 ls ""
let () =
	let ls = scanf " %s" (fun v -> v) |> char_list_of_string
	in let lt = scanf " %s" (fun v -> v) |> char_list_of_string
	in
	let rec rot ls_ i = match ls_ with
	| [] -> failwith ""
	| h::t -> (
		(* string_of_list (String.make 1) ls_ |> printf "%s\n"; *)
		if ls_ = lt then true
		else if i>0 && ls_ = ls then false
		else rot (t@[h]) (i+1)
	)
	in
	rot ls 0 |> (fun v -> if v then "Yes" else "No") |> print_endline
