x = eval(input())

y = eval(input())



l = []

for i in range(len(x)):

    s = x[-i - 1:] + x[:-i - 1]

    l.append(s)



if y in l:

    print("Yes")

else:

    print("No")
def main():

    x = eval(input())

    y = eval(input())



    l = []

    for i in range(len(x)):

        s = x[-i - 1:] + x[:-i - 1]

        l.append(s)



    if y in l:

        print("Yes")

    else:

        print("No")





def main2():

    x = eval(input())

    y = eval(input())

    ans = False



    s = x

    for i in range(len(x)):

        if s == y:

            ans = True

            break

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



    if ans:

        print("Yes")

    else:

        print("No")





if __name__ == '__main__':

    main2()

x = eval(input())
y = eval(input())
l = []
for i in range(len(x)):
    s = x[-i - 1 :] + x[: -i - 1]
    l.append(s)
if y in l:
    print("Yes")
else:
    print("No")

def main():
    x = eval(input())
    y = eval(input())
    l = []
    for i in range(len(x)):
        s = x[-i - 1 :] + x[: -i - 1]
        l.append(s)
    if y in l:
        print("Yes")
    else:
        print("No")


def main2():
    x = eval(input())
    y = eval(input())
    ans = False
    s = x
    for i in range(len(x)):
        if s == y:
            ans = True
            break
        s = s[-1] + s[:-1]
    if ans:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main2()

-x = eval(input()) -y = eval(input()) -l = [] -for i in range(len(x)): -    s = x[-i - 1 :] + x[: -i - 1] -    l.append(s) -if y in l: -    print("Yes") -else: -    print("No") +def main(): +    x = eval(input()) +    y = eval(input()) +    l = [] +    for i in range(len(x)): +        s = x[-i - 1 :] + x[: -i - 1] +        l.append(s) +    if y in l: +        print("Yes") +    else: +        print("No") + + +def main2(): +    x = eval(input()) +    y = eval(input()) +    ans = False +    s = x +    for i in range(len(x)): +        if s == y: +            ans = True +            break +        s = s[-1] + s[:-1] +    if ans: +        print("Yes") +    else: +        print("No") + + +if __name__ == "__main__": +    main2()