from collections import deque

s=list(eval(input()))

s=deque(s)

t=eval(input())

for i in range(len(s)):

    s.appendleft(s.pop())

    if t=="".join(s):

        print("Yes")

        exit()

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

t=eval(input())

for i in range(len(s)):

    s.insert(0,s.pop())

    word="".join(s)

    if word==t:

        print("Yes")

        exit()

print("No")
from collections import deque

s = list(eval(input()))
s = deque(s)
t = eval(input())
for i in range(len(s)):
    s.appendleft(s.pop())
    if t == "".join(s):
        print("Yes")
        exit()
print("No")

s = list(eval(input()))
t = eval(input())
for i in range(len(s)):
    s.insert(0, s.pop())
    word = "".join(s)
    if word == t:
        print("Yes")
        exit()
print("No")

-from collections import deque - -s = deque(s) -    s.appendleft(s.pop()) -    if t == "".join(s): +    s.insert(0, s.pop()) +    word = "".join(s) +    if word == t: