ring = input() * 2

word = input()



if ring.find(word) != -1:

    print("Yes")

else:

    print("No")
ring = input() * 2

word = input()



if word in ring:

    print("Yes")

else:

    print("No")
ring = input() * 2
word = input()
if ring.find(word) != -1:
    print("Yes")
else:
    print("No")

ring = input() * 2
word = input()
if word in ring:
    print("Yes")
else:
    print("No")

-if ring.find(word) != -1: +if word in ring: