import sys



s = eval(input())

t = eval(input())



a = int(len(s))



for i in range(0,a) :

    s = s[a-1::]+s[:a-1:]

    if s == t :

        print("Yes")

        sys.exit()



print("No")
s = eval(input())

t = eval(input())



if t in (s+s) :

    print("Yes")

else :

    print("No")
import sys

s = eval(input())
t = eval(input())
a = int(len(s))
for i in range(0, a):
    s = s[a - 1 : :] + s[: a - 1 :]
    if s == t:
        print("Yes")
        sys.exit()
print("No")

s = eval(input())
t = eval(input())
if t in (s + s):
    print("Yes")
else:
    print("No")

-import sys - -a = int(len(s)) -for i in range(0, a): -    s = s[a - 1 : :] + s[: a - 1 :] -    if s == t: -        print("Yes") -        sys.exit() -print("No") +if t in (s + s): +    print("Yes") +else: +    print("No")