S = eval(input())

T = eval(input())

ans = "No"

for i in range(len(S)):

  if(T == S[i:]+S[:i]):

    ans = "Yes"

print(ans)
S = eval(input())

T = eval(input())



ans = "No"

for i in range(len(S)):

  S[i:]+S[:i]

  if(S[i:]+S[:i] == T):

    ans = "Yes"

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

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

-    if T == S[i:] + S[:i]: +    S[i:] + S[:i] +    if S[i:] + S[:i] == T: