S=eval(input())

T=eval(input())

N=len(S)

for i in range(N):

  U=T[i:]+T[:i]

  if S==U:

    print("Yes")

    exit()

print("No")

# coding: utf-8

S = eval(input())

T = eval(input())

for i in range(100):

    Scheck=S[i+1:]+S[0:i+1]

    if(Scheck==T):

        print("Yes")

        exit()

print("No")

S = eval(input())
T = eval(input())
N = len(S)
for i in range(N):
    U = T[i:] + T[:i]
    if S == U:
        print("Yes")
        exit()
print("No")

# coding: utf-8
S = eval(input())
T = eval(input())
for i in range(100):
    Scheck = S[i + 1 :] + S[0 : i + 1]
    if Scheck == T:
        print("Yes")
        exit()
print("No")

+# coding: utf-8 -N = len(S) -for i in range(N): -    U = T[i:] + T[:i] -    if S == U: +for i in range(100): +    Scheck = S[i + 1 :] + S[0 : i + 1] +    if Scheck == T: