s = eval(input())

p = eval(input())

  

if p in (s * 2):

    print("Yes")

else:

    print("No")
z=eval(input())*2

x=eval(input())

a=z.count(x)



if a>=1:

    print("Yes")

else:

    print('No')
s = eval(input())
p = eval(input())
if p in (s * 2):
    print("Yes")
else:
    print("No")

z = eval(input()) * 2
x = eval(input())
a = z.count(x)
if a >= 1:
    print("Yes")
else:
    print("No")

-s = eval(input()) -p = eval(input()) -if p in (s * 2): +z = eval(input()) * 2 +x = eval(input()) +a = z.count(x) +if a >= 1: