S = input().strip()

T = input().strip()

ans = 'No'

for _ in range(len(S)):

  S = S[-1] + S[:-1]

  if S == T:

    ans = 'Yes'

    break

print(ans)
S = input().strip()

T = input().strip()

# S+SはSを回転させた文字列のすべてを含む

ans = 'Yes' if T in S+S else 'No'

print(ans)
S = input().strip()
T = input().strip()
ans = "No"
for _ in range(len(S)):
    S = S[-1] + S[:-1]
    if S == T:
        ans = "Yes"
        break
print(ans)

S = input().strip()
T = input().strip()
# S+SはSを回転させた文字列のすべてを含む
ans = "Yes" if T in S + S else "No"
print(ans)

-ans = "No" -for _ in range(len(S)): -    S = S[-1] + S[:-1] -    if S == T: -        ans = "Yes" -        break +# S+SはSを回転させた文字列のすべてを含む +ans = "Yes" if T in S + S else "No"