



def rolling(str, n):

    return str[n:len(str)] + str[:n]





def solve():

    S = eval(input())

    T = eval(input())



    for i in range(len(S)):

        if rolling(S, i) == T:

            print("Yes")

            exit()



    print("No")





# Solve

if __name__ == "__main__":

    solve()



 
def rolling(str, n):

    return str[n:len(str)] + str[:n]





S = eval(input())

T = eval(input())

for i in range(len(S)):

    if rolling(S, i) == T:

        print("Yes")

        exit()



print("No")

def rolling(str, n):
    return str[n : len(str)] + str[:n]


def solve():
    S = eval(input())
    T = eval(input())
    for i in range(len(S)):
        if rolling(S, i) == T:
            print("Yes")
            exit()
    print("No")


# Solve
if __name__ == "__main__":
    solve()

def rolling(str, n):
    return str[n : len(str)] + str[:n]


S = eval(input())
T = eval(input())
for i in range(len(S)):
    if rolling(S, i) == T:
        print("Yes")
        exit()
print("No")

-def solve(): -    S = eval(input()) -    T = eval(input()) -    for i in range(len(S)): -        if rolling(S, i) == T: -            print("Yes") -            exit() -    print("No") - - -# Solve -if __name__ == "__main__": -    solve() +S = eval(input()) +T = eval(input()) +for i in range(len(S)): +    if rolling(S, i) == T: +        print("Yes") +        exit() +print("No")