s = list(eval(input()))

t = eval(input())

n = len(s)

f = False

for i in range(n):

    tmp = s[n-1]

    for j in range(n-1,-1,-1):

        s[j] = s[j-1]

    s[0] = tmp

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

        print("Yes")

        f = True

        break

if not f:

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

t = eval(input())

n = len(s)

f = False

for i in range(n):

    if s == t:

        f = True

        break

    else:

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

if f:

    print("Yes")

else:

    print("No")

        
s = list(eval(input()))
t = eval(input())
n = len(s)
f = False
for i in range(n):
    tmp = s[n - 1]
    for j in range(n - 1, -1, -1):
        s[j] = s[j - 1]
    s[0] = tmp
    if t == "".join(s):
        print("Yes")
        f = True
        break
if not f:
    print("No")

s = eval(input())
t = eval(input())
n = len(s)
f = False
for i in range(n):
    if s == t:
        f = True
        break
    else:
        s = s[n - 1] + s[: n - 1]
if f:
    print("Yes")
else:
    print("No")

-s = list(eval(input())) +s = eval(input()) -    tmp = s[n - 1] -    for j in range(n - 1, -1, -1): -        s[j] = s[j - 1] -    s[0] = tmp -    if t == "".join(s): -        print("Yes") +    if s == t: -if not f: +    else: +        s = s[n - 1] + s[: n - 1] +if f: +    print("Yes") +else: