s = eval(input())

p = eval(input())

p_len = len(p)



if p in s:

    print("Yes")

else:

    for i in range(p_len):

        if (p[:i] == s[-i:]) and (p[i:] == s[:p_len - i]):

            print("Yes")

            break

    else:

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

p = eval(input())



if p in (s * 2):

    print("Yes")

else:

    print("No")
s = eval(input())
p = eval(input())
p_len = len(p)
if p in s:
    print("Yes")
else:
    for i in range(p_len):
        if (p[:i] == s[-i:]) and (p[i:] == s[: p_len - i]):
            print("Yes")
            break
    else:
        print("No")

s = eval(input())
p = eval(input())
if p in (s * 2):
    print("Yes")
else:
    print("No")

-p_len = len(p) -if p in s: +if p in (s * 2): -    for i in range(p_len): -        if (p[:i] == s[-i:]) and (p[i:] == s[: p_len - i]): -            print("Yes") -            break -    else: -        print("No") +    print("No")