def rolling(str, n):

    return str[n:len(str)] + str[:n]





S = eval(input())

T = eval(input())

for i in range(len(S)):

    if rolling(S, i) == T:

        print("Yes")

        exit()



print("No")

S = list(eval(input()))

T = list(eval(input()))





def rolling(str, n):

    return str[n:len(str)] + str[:n]





for i in range(len(S)):

    if S == rolling(T, i):

        print("Yes")

        exit()



print("No")

def rolling(str, n):
    return str[n : len(str)] + str[:n]


S = eval(input())
T = eval(input())
for i in range(len(S)):
    if rolling(S, i) == T:
        print("Yes")
        exit()
print("No")

S = list(eval(input()))
T = list(eval(input()))


def rolling(str, n):
    return str[n : len(str)] + str[:n]


for i in range(len(S)):
    if S == rolling(T, i):
        print("Yes")
        exit()
print("No")

+S = list(eval(input())) +T = list(eval(input())) + + -S = eval(input()) -T = eval(input()) -    if rolling(S, i) == T: +    if S == rolling(T, i):