s = eval(input())

t = eval(input())



for i in range(len(s)):

    if s[i:]+s[:i] == t:

        print("Yes")

        exit()



print("No")
s, t = eval(input()), eval(input())

 

cnt = 0

while cnt <= len(s):

    s = s[-1] + s[:-1]

    if s == t:

        print("Yes")

        exit()

    cnt+=1

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

s, t = eval(input()), eval(input())
cnt = 0
while cnt <= len(s):
    s = s[-1] + s[:-1]
    if s == t:
        print("Yes")
        exit()
    cnt += 1
print("No")

-s = eval(input()) -t = eval(input()) -for i in range(len(s)): -    if s[i:] + s[:i] == t: +s, t = eval(input()), eval(input()) +cnt = 0 +while cnt <= len(s): +    s = s[-1] + s[:-1] +    if s == t: +    cnt += 1