p=eval(input())

s=eval(input())



ret = 'Yes'

try: (p+p).index(s)

except : ret = 'No'

print(ret)
s = eval(input())

p = eval(input())

ret = 'No'

tts = s + s[:len(p)]

if p in tts: ret = 'Yes'

print(ret)

p = eval(input())
s = eval(input())
ret = "Yes"
try:
    (p + p).index(s)
except:
    ret = "No"
print(ret)

s = eval(input())
p = eval(input())
ret = "No"
tts = s + s[: len(p)]
if p in tts:
    ret = "Yes"
print(ret)

+s = eval(input()) -s = eval(input()) -ret = "Yes" -try: -    (p + p).index(s) -except: -    ret = "No" +ret = "No" +tts = s + s[: len(p)] +if p in tts: +    ret = "Yes"