# Ring

ring = input()
word = input()

doubleRing = ring * 2
ringCut = doubleRing.split(word)
# print(ringCut)

if ringCut[0] == doubleRing:
    print('No')
else:
    print('Yes')


d88b1acd076e679b322e1010c625dd2dc0adcfc7
<mask token>

<mask token>
if ringCut[0] == doubleRing:
    print('No')
else:
    print('Yes')

ring = input()
word = input()
doubleRing = ring * 2
ringCut = doubleRing.split(word)
if ringCut[0] == doubleRing:
    print('No')
else:
    print('Yes')

# Ring

ring = input()
word = input()

doubleRing = ring * 2
ringCut = doubleRing.split(word)
# print(ringCut)

if ringCut[0] == doubleRing:
    print('No')
else:
    print('Yes')

