a = input()

b = input()

a = a+a

if 0 < a.count(b):

    print('Yes')

else:

    print('No')
a = input()

b = input()

a = a+a

if 0 <= a.find(b):

    print('Yes')

else:

    print('No')
a = input()
b = input()
a = a + a
if 0 < a.count(b):
    print("Yes")
else:
    print("No")

a = input()
b = input()
a = a + a
if 0 <= a.find(b):
    print("Yes")
else:
    print("No")

-if 0 < a.count(b): +if 0 <= a.find(b):