s = eval(input())

t = eval(input())

for _ in range(len(s)):

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

    #print(s)

    if s == t:

        print("Yes")

        exit()

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

t = eval(input())



for i in range(len(s)):

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

    #print(s)

    if s == t:

        print('Yes')

        exit()

print('No')
s = eval(input())
t = eval(input())
for _ in range(len(s)):
    s = s[-1] + s[:-1]
    # print(s)
    if s == t:
        print("Yes")
        exit()
print("No")

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

-for _ in range(len(s)): +for i in range(len(s)):