s=input()

target=input()

ring=s*2

f=0



for i in range(len(s)):

	if ring[i:i+len(target)]==target:

		f=1

		break

if f==1:

	print("Yes")

else:

	print("No")
s=input()

target=input()

ring=s*2



ans="No"

for i in range(len(s)):

	if ring[i:i+len(target)]==target:

		ans="Yes"

		break

print(ans)
s = input()
target = input()
ring = s * 2
f = 0
for i in range(len(s)):
    if ring[i : i + len(target)] == target:
        f = 1
        break
if f == 1:
    print("Yes")
else:
    print("No")

s = input()
target = input()
ring = s * 2
ans = "No"
for i in range(len(s)):
    if ring[i : i + len(target)] == target:
        ans = "Yes"
        break
print(ans)

-f = 0 +ans = "No" -        f = 1 +        ans = "Yes" -if f == 1: -    print("Yes") -else: -    print("No") +print(ans)