from collections import deque

s = deque(list(eval(input())))

t = deque(list(eval(input())))



for i in range(len(s)+1):

  if s == t:

    print("Yes")

    exit()

  p = s.pop()

  s.appendleft(p)

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

t = eval(input())



n = 0

m = len(s)

while n != m:

  if s == t:

    print("Yes")

    exit()

  s = s[-1]+s[:m-1]

  n += 1

print("No")
from collections import deque

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

s = eval(input())
t = eval(input())
n = 0
m = len(s)
while n != m:
    if s == t:
        print("Yes")
        exit()
    s = s[-1] + s[: m - 1]
    n += 1
print("No")

-from collections import deque - -s = deque(list(eval(input()))) -t = deque(list(eval(input()))) -for i in range(len(s) + 1): +s = eval(input()) +t = eval(input()) +n = 0 +m = len(s) +while n != m: -    p = s.pop() -    s.appendleft(p) +    s = s[-1] + s[: m - 1] +    n += 1