s = eval(input())

p = eval(input())



if p in s+s:

    print('Yes')

else:

    print('No')
def main():

    s = eval(input())

    p = eval(input())



    if p in s*2:

        print("Yes")

    else:

        print("No")



if __name__ == '__main__':

    main()



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

def main():
    s = eval(input())
    p = eval(input())
    if p in s * 2:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

-s = eval(input()) -p = eval(input()) -if p in s + s: -    print("Yes") -else: -    print("No") +def main(): +    s = eval(input()) +    p = eval(input()) +    if p in s * 2: +        print("Yes") +    else: +        print("No") + + +if __name__ == "__main__": +    main()