s = eval(input())

t = eval(input())

for i in range(len(s)):

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

                print('Yes')

                exit()

print('No')
s = eval(input())

t = eval(input())



for i in range(len(s)):

    s = s[1:] + s[0]

    if s == t:

        print("Yes")

        exit()

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 = eval(input())
t = eval(input())
for i in range(len(s)):
    s = s[1:] + s[0]
    if s == t:
        print("Yes")
        exit()
print("No")

-    if s[i:] + s[:i] == t: +    s = s[1:] + s[0] +    if s == t: