from sys import stdin                                                                                                                                                                                       
S = stdin.readline().rstrip()                                                                                                                                                                               
T = stdin.readline().rstrip()                                                                                                                                                                               
                                                                                                                                                                                                            
sl = list(S)                                                                                                                                                                                                
for x in range(len(S)):                                                                                                                                                                                     
    if S == T:                                                                                                                                                                                              
        print("Yes")                                                                                                                                                                                        
        break                                                                                                                                                                                               
    fin = sl.pop()                                                                                                                                                                                          
    sl =list(fin) + sl                                                                                                                                                                                      
    sl2 = "".join(sl)                                                                                                                                                                                       
    if sl2 == T:                                                                                                                                                                                            
        print("Yes")                                                                                                                                                                                        
        break                                                                                                                                                                                               
    if x == len(S) - 1:                                                                                                                                                                                     
        print("No")

Measured memory_bytes: 3060