# ABC103 B-StringRotation

S = [s for s in eval(input())]

T = eval(input())

S_ = []

S_Jugde = ""



for i in range(len(S)):

    S_ = S[:]

    for j in range(len(S)-1):

        if j == 0:

            S[0] = S_[len(S)-1]

        S[j+1] = S_[j]



        if j == len(S)-2:

            S_Jugde = "".join(S)

            if S_Jugde == T:

                print("Yes")

                exit()

print("No")
s=eval(input())

t=eval(input())

n=len(s)

for i in range(n):

    s+=s[i]

    # print(s[i+1:])

    if s[i+1:]==t:

        print('Yes')

        exit()

print('No')
# ABC103 B-StringRotation
S = [s for s in eval(input())]
T = eval(input())
S_ = []
S_Jugde = ""
for i in range(len(S)):
    S_ = S[:]
    for j in range(len(S) - 1):
        if j == 0:
            S[0] = S_[len(S) - 1]
        S[j + 1] = S_[j]
        if j == len(S) - 2:
            S_Jugde = "".join(S)
            if S_Jugde == T:
                print("Yes")
                exit()
print("No")

s = eval(input())
t = eval(input())
n = len(s)
for i in range(n):
    s += s[i]
    # print(s[i+1:])
    if s[i + 1 :] == t:
        print("Yes")
        exit()
print("No")

-# ABC103 B-StringRotation -S = [s for s in eval(input())] -T = eval(input()) -S_ = [] -S_Jugde = "" -for i in range(len(S)): -    S_ = S[:] -    for j in range(len(S) - 1): -        if j == 0: -            S[0] = S_[len(S) - 1] -        S[j + 1] = S_[j] -        if j == len(S) - 2: -            S_Jugde = "".join(S) -            if S_Jugde == T: -                print("Yes") -                exit() +s = eval(input()) +t = eval(input()) +n = len(s) +for i in range(n): +    s += s[i] +    # print(s[i+1:]) +    if s[i + 1 :] == t: +        print("Yes") +        exit()