S = eval(input())

T = eval(input())



for i in range(len(S)):

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

        print('Yes')

        break

else:

    print('No')
S = eval(input())

T = eval(input())



for i in range(len(S)):

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

        print('Yes')

        exit()

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

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

-    if T == S[i:] + S[:i]: +    if S[i:] + S[:i] == T: -        break -else: -    print("No") +        exit() +print("No")