You are given string S and T consisting of lowercase English letters.
Determine if S equals T after rotation.
That is, determine if S equals T after the following operation is performed some number of times:
Operation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.
Here, |X| denotes the length of the string X.

-----Constraints-----
 - 2 \leq |S| \leq 100
 - |S| = |T|
 - S and T consist of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
S
T

-----Output-----
If S equals T after rotation, print Yes; if it does not, print No.

-----Sample Input-----
kyoto
tokyo

-----Sample Output-----
Yes

 - In the first operation, kyoto becomes okyot.
 - In the second operation, okyot becomes tokyo.

Difficulty: EASY

Solutions:
S = input()
T = input()
num = len(T)
for i in range(num):
	rotation_S = S[i:] + S[:i]
	if rotation_S == T:
		answer = 'Yes'
		break
	else:
		answer = 'No'
print(answer)


(s, t) = (input(), input())
if t in s + s:
	print('Yes')
else:
	print('No')


def answer(s: str, t: str) -> str:
	for _ in range(len(s)):
		if t == s:
			return 'Yes'
		s = s[-1] + s[:-1]
	return 'No'

def main():
	s = input()
	t = input()
	print(answer(s, t))

def __starting_point():
	main()
__starting_point()


a = input()
b = input()
print('Yes' if (a + a).find(b) != -1 else 'No')


print('Yes' if input() in input() * 2 else 'No')


s = str(input()) * 2
t = str(input())
if t in s:
	print('Yes')
else:
	print('No')


S = str(input())
T = str(input())
ans_list = []
for i in range(len(S)):
	i = S[-1] + S[0:-1]
	ans_list.append(i)
	S = i
if T in ans_list:
	print('Yes')
else:
	print('No')


s = input()
t = input()
s = s * 2
try:
	s.index(t)
	print('Yes')
except:
	print('No')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
from collections import deque
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def main():
	s = S()
	t = S()
	l = len(s)
	s += s
	t += t
	flag = False
	for i in range(l):
		for j in range(l):
			if s[i:i + l] == t[j:j + l]:
				flag = True
	if flag:
		print('Yes')
	else:
		print('No')
main()


print('Yes' if (input() * 2).find(input()) != -1 else 'No')


a = input()
b = input()
c = b * 2
if a in c:
	print('Yes')
else:
	print('No')


S = input()
T = input()
S2 = S + S
print('Yes' if T in S2 else 'No')


S = input()
T = input()
print('Yes' if T in S * 2 else 'No')


(s, t) = (input(), input())
n = len(s)
ans = 'No'
for i in range(n):
	s = s[-1] + s[:-1]
	if s == t:
		ans = 'Yes'
		break
print(ans)


s = input()
t = input()
s_temp = s
answer = 'No'
for i in range(len(s)):
	s_temp = s[i:] + s[:i]
	if s_temp == t:
		answer = 'Yes'
		break
print(answer)


print('YNeos'[input() not in input() * 2::2])


S = str(input())
T = str(input())
T = T + T
if S in T:
	print('Yes')
else:
	print('No')


s = input()
t = input()
for i in range(len(s)):
	if s[i:] + s[:i] == t:
		print('Yes')
		return
print('No')


(S, T) = (input() * 2, input())
print(['No', 'Yes'][T in S])


str1 = input()
str2 = input()
print('Yes' if str2 in str1 * 2 else 'No')


S = input()
T = input()
S = S + S
print('Yes') if S.find(T) >= 0 else print('No')


S = input()
T = input()
for i in range(100):
	S = S[-1] + S
	S = S[0:len(S) - 1]
	if S == T:
		print('Yes')
		return
print('No')


S = input()
T = input()
TT = T + T
if S in TT:
	print('Yes')
else:
	print('No')


a = input()
b = input()
c = 0
for i in range(len(a)):
	if b[i:len(a)] + b[0:i] == a:
		print('Yes')
		break
	else:
		c += 1
if c == len(a):
	print('No')


S = input()
T = input()
ans = T
for i in range(len(S)):
	ans = ans[-1] + ans[:-1]
	if S == ans:
		print('Yes')
		break
else:
	print('No')


s = input() * 2
t = input()
print('Yes' if sum([s[i:i + len(t)] == t for i in range(len(t))]) else 'No')


s = input()
t = input()
k = 0
for i in range(len(s)):
	x = s[i:] + s[:i]
	if x == t:
		k = 1
		break
if k == 1:
	print('Yes')
else:
	print('No')


S = input()
S += S
if S.find(input()) != -1:
	print('Yes')
else:
	print('No')


(S, T) = open(0).read().split()
print('Yes' if T in S + S else 'No')


s1 = input()
print('Yes' if input() in tuple((s1[i:] + s1[:i] for i in range(len(s1)))) else 'No')


s = input()
t = input()
ss = s * 2
if t in ss:
	print('Yes')
else:
	print('No')


s = str(input())
t = str(input())

def answer(s: str, t: str) -> str:
	for i in range(len(s)):
		tmp = s[i:] + s[:i]
		if tmp == t:
			return 'Yes'
			break
	else:
		return 'No'
print(answer(s, t))


import sys
S = input().strip()
T = input().strip()
ans = 'No'
for _ in range(len(S)):
	S = S[-1] + S[:-1]
	if S == T:
		ans = 'Yes'
print(ans)


S = input()
T = input()
Ss = [S[n:] + S[:n] for n in range(len(S))]
print('Yes' if T in Ss else 'No')


S = str(input())
T = str(input())
x = len(S)
for i in range(0, x):
	if S[i:] + S[:i] == T:
		print('Yes')
		return
print('No')


S = input() * 2
T = input()
N = len(T)
for i in range(N):
	if T == S[i:N + i]:
		ans = 'Yes'
		break
else:
	ans = 'No'
print(ans)


a = input()
b = input()
print(['No', 'Yes'][b in a * 2])


s = input()
t = input()
srot = s * 2
if srot.count(t) != 0:
	print('Yes')
else:
	print('No')


S = input()
T = str(input())
s = list(S)
s_len = len(S)
i = 0
while i < s_len:
	s.insert(0, s[-1])
	s.pop(-1)
	new_s = ''.join(s)
	i += 1
	if new_s == T:
		print('Yes')
		break
else:
	print('No')


s = input()
t = input()
print('Yes' if any((s == t[i:] + t[:i] for i in range(len(t)))) else 'No')


S = list(input())
T = list(input())
ans = 'No'
for i in S:
	tmp = S.pop()
	S.insert(0, tmp)
	''.join(S)
	if S == T:
		ans = 'Yes'
		break
print(ans)


(s, t) = [input() for _ in range(2)]
if s in t * 2:
	print('Yes')
else:
	print('No')


s = input()
t = input()
print(['No', 'Yes'][t in s * 2])


def main():
	s = input()
	t = input()
	ans = 'No'
	s2 = s * 2
	for i in range(len(s2)):
		if t == s2[i:i + len(s)]:
			ans = 'Yes'
			break
	print(ans)

def __starting_point():
	main()
__starting_point()


s = str(input())
t = str(input())
t_ = t + t
if s in t_:
	print('Yes')
else:
	print('No')


s = input()
t = input()
answer = 'Yes' if s in t * 2 else 'No'
print(answer)


s = input()
t = input()
print('YNeos'[s not in t * 3::2])


import sys
input = sys.stdin.readline

def main():
	s = list(input().rstrip())
	t = input().rstrip()
	for i in range(len(s)):
		if t == ''.join(s):
			print('Yes')
			return
		else:
			tmp = s.pop(0)
			s.append(tmp)
	print('No')

def __starting_point():
	main()
__starting_point()


s = input()
t = input()
origin = s
if s == t:
	print('Yes')
	return
s = s[1:] + s[0]
while s != origin:
	if s == t:
		print('Yes')
		return
	s = s[1:] + s[0]
print('No')


list_s = list(input())
list_t = list(input())
n = len(list_s)
for i in range(0, n):
	if ''.join(list_s) == ''.join(list_t):
		print('Yes')
		return
	list_s.insert(0, list_s[n - 1])
	list_s.pop(-1)
print('No')


s = input()
ss = input()
ss = ss + ss[0:-1]
if s in ss:
	print('Yes')
else:
	print('No')


S = input()
T = input()
for i in range(len(S)):
	s = S[i:] + S[:i]
	if s == T:
		print('Yes')
		return
print('No')


s = input()
t = input()
s = list(s)
t = list(t)
count = 0
judgment = 0
while count <= len(s):
	item = s.pop()
	s.insert(0, item)
	if s == t:
		judgment += 1
	count += 1
if judgment == 0:
	print('No')
else:
	print('Yes')


s = input()
t = input()
x = s + s
if x.count(t) != 0:
	print('Yes')
else:
	print('No')


a = input()
b = input()
a = a + a + a
if b in a:
	print('Yes')
else:
	print('No')


s = input()
t = input()
for i in range(200):
	s = s[-1] + s[:-1]
	if s == t:
		print('Yes')
		exit()
print('No')


S = list(input())
T = list(input())
match = 0
for _ in S:
	i = S.pop()
	S.insert(0, i)
	''.join(S)
	if S == T:
		match += 1
		break
if match == 0:
	print('No')
else:
	print('Yes')


S = input()
T = input()
U = S + S
if T in U:
	print('Yes')
else:
	print('No')


def get_input() -> tuple:
	S = input()
	T = input()
	return (S, T)

def main(S: str, T: str) -> None:
	N = len(S)
	ans = 'No'
	for i in range(N):
		if S[-i:] + S[:-i] == T:
			ans = 'Yes'
			break
	print(ans)

def __starting_point():
	(S, T) = get_input()
	main(S, T)
__starting_point()


S = input()
T = input()
N = len(S)
for i in range(N + 1):
	if S[-i:N] + S[0:-i + N] == T:
		print('Yes')
		break
else:
	print('No')


S = input()
T = input()
n = len(S) + 1
while n:
	S = S[-1] + S[:-1]
	if S == T:
		print('Yes')
		return
	n -= 1
print('No')


S = input()
T = input()
S = S * 2
yes = S.find(T) != -1
print('Yes' if yes else 'No')


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LSS():
	return input().split()

def resolve():
	S = SS()
	T = SS()
	l = len(S)
	S2 = S * 2
	ans = 'No'
	for i in range(l):
		if S2[i:i + l] == T:
			ans = 'Yes'
			break
	print(ans)

def __starting_point():
	resolve()
__starting_point()


s = input().rstrip()
t = input().rstrip()
s = s + s
print('No') if s.find(t) == -1 else print('Yes')


S = input()
T = input()
if S == T:
	print('Yes')
else:
	ans = 'No'
	S = list(S)
	for i in range(len(S)):
		s = S.pop()
		S.insert(0, s)
		if ''.join(S) == T:
			ans = 'Yes'
			break
	print(ans)


s = input()
t = input()
S = s * 2
if t in S:
	print('Yes')
else:
	print('No')


s = input()
t = input()
b = s * 2
if t in b:
	print('Yes')
else:
	print('No')


S = input()
T = input()
S += S
A = S.find(T)
if A != -1:
	print('Yes')
else:
	print('No')


s1 = input()
s2 = input()
if (s1 + s1).find(s2) >= 0:
	print('Yes')
	quit()
print('No')


s = input()
ss = input()
ss += ss
if s in ss:
	print('Yes')
else:
	print('No')


s = input()
t = input()
ans = 'No'
for _ in range(len(s)):
	s = s[-1] + s[0:len(s) - 1]
	if s == t:
		ans = 'Yes'
		break
print(ans)


s = list(input())
t = list(input())
ans = 'No'
for i in range(len(s) + 1):
	if s[-i:] + s[:len(s) - i] == t:
		ans = 'Yes'
print(ans)


a = input()
b = input()
ans = 'No'
for i in a:
	a = a[-1] + a[:-1]
	if b == a:
		ans = 'Yes'
print(ans)


a = input()
b = input()
A = a * 2
if b in A:
	print('Yes')
else:
	print('No')


s = input()
t = input()
for i in range(len(s)):
	if s == t[i:] + t[:i]:
		print('Yes')
		exit(0)
print('No')


(S, T) = [input() for _ in range(2)]
print('Yes' if T in [S[i:] + S[:i] for i in range(len(S))] else 'No')


S = input()
T = input()
N = len(S)
check = False
for i in range(N):
	S = S[-1] + S[:-1]
	if S == T:
		check = True
print('Yes' if check else 'No')


s = input()
t = input()
length = len(s)
for _ in range(length):
	s = s[-1] + s[:length - 1]
	if s == t:
		print('Yes')
		break
else:
	print('No')


n = input()
m = input()
n *= 2
if m in n:
	print('Yes')
else:
	print('No')


s = input()
t = input()
if str(s * 2).count(t):
	print('Yes')
else:
	print('No')


S = input()
T = input()
print('YNeos'[all((S[i:] + S[:i] != T for i in range(len(S))))::2])


s = [a for a in input()]
t = [b for b in input()]
temp = None
for _ in range(len(s)):
	if s == t:
		print('Yes')
		return
	temp = s.pop(0)
	s.append(temp)
print('No')


import sys
s = input()
t = input()
s += s
if t in s:
	print('Yes')
else:
	print('No')


s = input()
t = input()
print('YNeos'[all((s[i:] + s[:i] != t for i in range(len(s))))::2])


S = input() * 2
T = input()
print('Yes' if S.count(T) > 0 else 'No')


S = input()
T = input()
temp = S
for i in range(len(S)):
	if temp == T:
		print('Yes')
		return
	else:
		temp = temp[-1] + temp[:-1]
print('No')


s = input()
t = input()
if t == s:
	print('Yes')
	return
else:
	for i in range(1, len(s)):
		st = s[-i:] + s[:len(s) - i]
		if st == t:
			print('Yes')
			return
print('No')


s = input()
t = input()
s_num = len(s)
i = 0
a = 0
while i < s_num:
	if s == t:
		a = 1
	s = s[-1] + s[0:s_num - 1]
	i = i + 1
if a == 1:
	print('Yes')
else:
	print('No')


s = input()
t = input()
ans = 0
for i in range(len(s)):
	s = s[-1] + s[:-1]
	if s == t:
		ans = 1
print('Yes' if ans == 1 else 'No')


S = input()
T = input()

def ans103(S: str, T: str):
	jugde_count = 0
	for i in range(0, len(S)):
		S = S[-1] + S[:-1]
		if T == S:
			jugde_count += 1
	if jugde_count > 0:
		return 'Yes'
	else:
		return 'No'
print(ans103(S, T))


s = list(input())
t = list(input())
ans = 'No'
for i in range(len(s)):
	s0 = s[0]
	s.remove(s0)
	s.append(s0)
	if s == t:
		ans = 'Yes'
		break
print(ans)


s = input()
t = input()
print('Yes' if (s * 2).find(t) >= 0 else 'No')


import copy
s = list(input())
t = list(input())
bool = False
for i in range(len(s)):
	temp = copy.copy(s)
	if s == t:
		bool = True
	for j in range(len(s)):
		if j == 0:
			s[0] = temp[len(s) - 1]
		else:
			s[j] = temp[j - 1]
if bool:
	print('Yes')
else:
	print('No')


S = str(input())
T = str(input())
a = len(S)
for i in range(0, a):
	if S[i:] + S[:i] == T:
		print('Yes')
		break
else:
	print('No')


from itertools import groupby

class Combination:

	def __init__(self, n, mod):
		self.n = n
		self.mod = mod
		self.fac = [1 for i in range(self.n + 1)]
		self.finv = [1 for i in range(self.n + 1)]
		for i in range(2, self.n + 1):
			self.fac[i] = self.fac[i - 1] * i % self.mod
			self.finv[i] = self.finv[i - 1] * pow(i, -1, self.mod) % self.mod

	def comb(self, n, m):
		return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod

def iparse():
	return list(map(int, input().split()))

def runLengthEncode(S: str):
	grouped = groupby(S)
	res = []
	for (k, v) in grouped:
		res.append((k, str(len(list(v)))))
	return res

def __starting_point():
	s = input()
	t = input()
	s = s + s
	for i in range(len(t)):
		if t == s[i:i + len(t)]:
			print('Yes')
			return
	print('No')
__starting_point()


s = str(input())
t = str(input())
N = len(s)
S = [0] * N
T = [0] * N
for i in range(N):
	S[i] = s[i]
	T[i] = t[i]
for i in range(N):
	for j in range(N):
		if j == 0:
			x = S[j]
			S[j] = S[j + 1]
		elif 1 <= j < N - 1:
			S[j] = S[j + 1]
		else:
			S[j] = x
	if S == T:
		print('Yes')
		return
print('No')


S = input()
T = input()
print('YNeos'[T not in S + S::2])


(S, T) = map(str, [input() for i in range(0, 2)])
print('Yes' if str(T + T).find(S) >= 0 else 'No')


import re
S = input()
T = input()
S2 = S * 2
if re.search(T, S2):
	print('Yes')
else:
	print('No')


s = input()
t = input()
res = 'No'

def rotate(a):
	n = len(a)
	a = a[n - 1] + a[:n - 1]
	return a
for i in range(len(s)):
	if s == t:
		res = 'Yes'
		break
	s = rotate(s)
print(res)


S = input()
T = input()
if (S + S).count(T) >= 1:
	print('Yes')
else:
	print('No')


def main():
	s = input()
	t = input()
	x = len(s)
	for index in range(x):
		if s[index + 1:] + s[:index + 1] == t:
			print('Yes')
			return
	print('No')
main()


import sys
lines = [s.rstrip('\n') for s in sys.stdin.readlines()]
s = lines.pop(0)
t = lines.pop(0)
for i in range(len(s)):
	if s[i:] + s[:i] == t:
		print('Yes')
		break
else:
	print('No')


S = input()
T = input()
T2 = T + T
print('Yes' if S in T2 else 'No')


s = input()
t = input()
flag = False
for i in range(1, len(s) + 1):
	if s[-i:] + s[:len(s) - i] == t:
		flag = True
		break
print('Yes' if flag else 'No')


S = input()
T = input()
T = T + T
index = T.find(S)
if index == -1:
	print('No')
else:
	print('Yes')


print('NYoe s'[input() in input() * 2::2])


S = input()
T = input()
for i in range(len(S)):
	x = S[-i:] + S[:-i]
	if x == T:
		print('Yes')
		break
else:
	print('No')


print(['No', 'Yes'][input() in input() * 2])


s = input()
t = input()
u = s * 2
if t in u:
	print('Yes')
else:
	print('No')


s = input()
t = input()
total = False
for i in range(len(s)):
	s = s[len(s) - 1] + s[0:len(s) - 1]
	if s == t:
		print('Yes')
		total = True
		break
if total == False:
	print('No')


S = input()
T = input()
r = 'No'
t2 = T + T
if set(S) == set(T):
	if t2.count(S) > 0:
		r = 'Yes'
else:
	r = 'No'
print(r)


S = [i for i in input()]
T = input()
S = S * 2
if T in ''.join(S):
	print('Yes')
else:
	print('No')


s = input()
t = input() * 2
if t.find(s) != -1:
	print('Yes')
else:
	print('No')


print('Yes' if (input() * 2).count(input()) > 0 else 'No')


S = str(input())
T = str(input())
a = len(S)
L = S * a
if T in L:
	print('Yes')
else:
	print('No')


import sys
S = input()
T = input()
for i in range(len(S)):
	s = S[i:] + S[:i]
	for j in range(len(S)):
		if s == T:
			print('Yes')
			return
print('No')


a = input()
b = input()
ok = 'No'
for i in range(len(a)):
	if b == a[i:] + a[:i]:
		ok = 'Yes'
print(ok)


s = input()
print(['No', 'Yes'][input() in [s[i:] + s[:i] for i in range(len(s))]])


S = input()
T = input()
String1 = list(S)
String2 = list(T)
N = len(String1)
for i in range(1, N):
	if String1 == String2:
		print('Yes')
		break
	Ex = String1.pop()
	String1.insert(0, Ex)
	if String1 == String2:
		print('Yes')
		break
else:
	print('No')


S = input()
T = input()
success = 0
for i in range(len(S)):
	if S[i:] + S[:i] == T:
		success += 1
if success >= 1:
	print('Yes')
else:
	print('No')


s = input()
t = input()
tt = t + t
if tt.find(s) != -1:
	print('Yes')
else:
	print('No')


s = list(input())
t = list(input())
S = s + s
c = 0
for i in range(len(s)):
	ch = 0
	for j in range(len(s)):
		if S[i + j] == t[j]:
			ch += 1
	if ch == len(s):
		c += 1
if c > 0:
	print('Yes')
else:
	print('No')


s = input()
t = input()
u = s + s
d = u.find(t)
if d == -1:
	print('No')
else:
	print('Yes')


S = input()
T = input()
cnt = 0
for i in range(len(S)):
	S = S[-1] + S[0:-1]
	if S == T:
		cnt = 1
		print('Yes')
		break
if cnt == 0:
	print('No')


S = input()
T = input()
flag = False
for i in range(len(S)):
	if flag:
		break
	if S[i] == T[0]:
		tem = i + 1
		f = 1
		if tem == len(S):
			tem = 0
		for t in range(1, len(T)):
			if T[t] == S[tem]:
				tem += 1
				if tem == len(S):
					tem = 0
			else:
				break
			if t == len(T) - 1:
				flag = True
if flag:
	print('Yes')
else:
	print('No')


a = input()
b = input()
print('NYoe s'[b in a * 2::2])


def resolve():
	S = input()
	T = input()
	print('Yes' if T in S * 2 else 'No')
resolve()


S = input()
T = input()
ans = 'No'
for i in range(len(S)):
	S = S[1:] + S[0]
	if S == T:
		ans = 'Yes'
print(ans)


S = input()
T = input()
for i in range(len(S)):
	if S == T:
		print('Yes')
		break
	else:
		lstS = list(S)
		s = lstS.pop()
		a = list(s) + lstS
		S = ''.join(a)
else:
	print('No')


s = input()
t = input()
ans = 'No'
for i in range(len(s)):
	a = s[i:] + s[0:i]
	if a == t:
		ans = 'Yes'
print(ans)


s = input()
t = input()

def turn(S):
	return S[-1] + S[:-1]
for i in range(len(s)):
	if s == t:
		print('Yes')
		return
	else:
		s = turn(s)
print('No')


A = input()
B = input()
if A in B * 3:
	print('Yes')
else:
	print('No')


import io
print('Yes' if input() in input() * 2 else 'No')


string = input()
rotated_string = input()
for i in range(len(string)):
	string = string[-1] + string[0:-1]
	if string == rotated_string:
		print('Yes')
		return
print('No')


original = input()
toVerify = input()
original = original * 3
if toVerify in original:
	print('Yes')
else:
	print('No')


s = input()
t = input()
Flag = False
for _ in range(len(s)):
	s = s[-1] + s[:-1]
	if s == t:
		Flag = True
if Flag:
	print('Yes')
else:
	print('No')


import sys
s = input()
t = input()
s = list(s)
t = list(t)
u = s[:]
for i in range(len(s)):
	u.append(s[i])
	u.remove(u[0])
	if u == t:
		print('Yes')
		return
print('No')


S = input()
T = input()
S_len = len(S)
S_change = ''
answer = 'No'
for _ in range(0, S_len):
	if S == T:
		answer = 'Yes'
		break
	S_change = S[-1]
	S = S[:-1]
	S = S_change + S
print(answer)


s = list(input())
t = list(input())
ans = 'No'
for _ in s:
	tmp = s.pop()
	s.insert(0, tmp)
	''.join(s)
	if s == t:
		ans = 'Yes'
		break
print(ans)


s = input()
t = input()
print('YNeos'[s not in [t[i:] + t[:i] for i in range(len(s))]::2])


import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda : sys.stdin.readline().rstrip()
rs = lambda : sys.stdin.readline().split()
ri = lambda : int(sys.stdin.readline())
rm = lambda : list(map(int, sys.stdin.readline().split()))
rl = lambda : list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10 ** 9 + 7
s = rr()
t = rr()
for i in range(len(s) + 3):
	if s == t:
		print('Yes')
		return
	else:
		s = s[-1] + s[:-1]
print('No')