#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
????????°?????????????´¢
"""
s = input().strip()
p = input().strip()
ret = "No"
for i in range(len(s)):
    if p in s:
        ret = "Yes"
        break
    # ?????????????????????????????????????????????push pop??????????????£??????
    s = s[1:] + s[0] # ????????????????????°????????????????????????

print(ret)
c0eb5c07c5c7bf4b5fa5353d4f094b2e452783fb
<mask token>

<mask token>
for i in range(len(s)):
    if p in s:
        ret = 'Yes'
        break
    s = s[1:] + s[0]
print(ret)

<mask token>
s = input().strip()
p = input().strip()
ret = 'No'
for i in range(len(s)):
    if p in s:
        ret = 'Yes'
        break
    s = s[1:] + s[0]
print(ret)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
????????°?????????????´¢
"""
s = input().strip()
p = input().strip()
ret = "No"
for i in range(len(s)):
    if p in s:
        ret = "Yes"
        break
    # ?????????????????????????????????????????????push pop??????????????£??????
    s = s[1:] + s[0] # ????????????????????°????????????????????????

print(ret)