Problem:
Ring Write a program which finds a pattern $p$ in a ring shaped text $s$.   Input In the first line, the text $s$ is given. In the second line, the pattern $p$ is given. Output If $p$ is in $s$, print Yes in a line, otherwise No . Constraints  $1 \leq $ length of $p \leq $ length of $s \leq 100$  $s$ and $p$ consists of lower-case letters  Sample Input 1 vanceknowledgetoad
advance Sample Output 1 Yes Sample Input 2 vanceknowledgetoad
advanced Sample Output 2 No

Solution (Python):


import sys
import re


def main():
    s = sys.stdin.readline()  
    p = sys.stdin.readline()  

    s = s.strip('\n') * 2
    p = p.strip('\n')

    if len(re.findall((p), s)) > 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
n = input()
n += n
if input() in n:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
p = input()

s = s + s

if p in s:
	print("Yes")
else:
	print("No")

Solution (Python):
I=input;s=I()*2;print(['No','Yes'][I()in s])

Solution (Python):
s2 = list(input()*2)
p = list(input())
for i in range(len(s2)-len(p)):
    a = [ s2[i+j] for j in range(len(p))]
    if a == p:
        print("Yes")
        break
else:
    print("No")

Solution (Python):
s=raw_input()
p=raw_input()

if p in s*2:
    print "Yes"
else:
    print "No"

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

Solution (Python):
str_list = input().rstrip()
str_search = input().rstrip()

str_list = str_list + str_list

if str_search in str_list:
    print("Yes")
else:
    print("No")

Solution (Python):
import re
s = input()
p = input()
s_loop = s + s
match = re.search(p, s_loop)
if not(match is None):
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
p = input()

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

Solution (Python):
s = input()
s += s
key = input()
if s.find(key) != -1: print("Yes")
else: print("No")

Solution (Python):
s = list(input())
p = list(input())

import sys

for i in range(len(s)):
	t=0
	for j in range(len(p)):
		if p[j] == s[(i+j)%len(s)]:
			t = t+1
			
		else:
			t = 0
		if t == len(p):
			print('Yes')
			sys.exit()

if t < len(p):
	print('No')

Solution (Python):
guruguru,line = (input() for i in range(2))
atama = []
target = line[0]
index = -1
saa = True
while True:
    index = guruguru.find(target, index + 1)
    atama.append(index)
    if index == -1:
        break
for i in range(len(atama)):
    stt = ""
    for i2 in range(len(guruguru)):
        if len(guruguru) <= atama[i]+i2:
            index += 1
            stt += guruguru[index]
        else:
            stt += guruguru[atama[i]+i2]
    if line in stt:
        print("Yes")
        saa = False
        break
    index = -1
if saa:
    print("No")

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

Solution (Python):
s, p = input() * 2, input()
print('Yes' if p in s else 'No')

Solution (Python):
s = input()
p = input()
tmp_s = s
flag = False
for i in range(len(s)):
    tmp_s = tmp_s[-1]+tmp_s[0:-1]
    if tmp_s.count(p)>0:
        flag = True
        break
    else:
        pass
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
ring = input()*2
words = input()

if words in ring:
    print("Yes")
else:
    print("No")

Solution (Python):


import sys
import os


s = input().strip()
q = input().strip()

s = s + s
if q in s:
    print('Yes')
else:
    print('No')

Solution (Python):
str_in = input()
str_val = input()

for i in range(len(str_in),-1,-1):
    flag = str_val in str_in  
    if flag:
        break
    if str_val[:i] == str_in[0-i:] and str_in.find(str_val[i:]) == 0:  
        flag = True
        break

if flag:
    print('Yes')
else:
    print('No')

Solution (Python):
def check(s, p):
    if s == p:
        return 1
    else:
        return 0

s = input()
p = input()

n = 0
answer = 0
while n < len(s) and answer == 0:
    answer = check(s[:len(p)], p)
    s0 = s[0:1]
    s1 = s[1:]
    s = s1 + s0
    n += 1

if answer:
    print("Yes")
else:
    print("No")

Solution (Python):



def func():
    try:
        ringstr=input().rstrip()
        instr=input().rstrip()
    except:
        return inputError()

    while(True):
        ringstr+=ringstr
        if(len(ringstr) >= len(instr)*2):
            break
    
    print("Yes" if (instr in ringstr) else "No")

def inputError():
    print("input Error")
    return -1
 
func()

Solution (Python):
if __name__ == '__main__':
    s = input() * 2
    key = input()

    if key in s[:-1]:
        print('Yes')
    else:
        print('No')

Solution (Python):
s = input()
p = input()

print("Yes" if p in s+s else "No")

Solution (Python):


s = input()
p = input()
exists = False

sRing = []
iArray = []

pLetter = p[0]

for i in range(len(s)):
    if s[i] == pLetter:
        iArray.append(i)

for i in iArray:
    sNew = s[i:] + s[:i]
    sRing.append(sNew)
    
for x in sRing:
    if p in x:
        exists = True

if exists == True:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()*3
if s.find(input()) == -1 :
    print('No')
else:
    print('Yes')

Solution (Python):
s = input()
p = input()
bl = True
if p in s:
    print("Yes")
    bl = False
if bl:
    for i in range(1,len(s)+1):
        if p[0:i] == s[-i:]:
            if p[i:] == s[0:len(p)-i]:
                print("Yes")
                bl = False
                break
if bl:
    print("No")

Solution (Python):
s = input()
p = input()

if p in s+s:
    print('Yes')
else:
    print('No')

Solution (Python):
S = input() *2
N = input()

if N in S:
 print("Yes")
else:
 print("No")

Solution (Python):
s = input()
p = input()
s = s * 2
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input() * 2
p = input()
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):


moji =input().rstrip()
moji +=moji

tukuru = input().rstrip()

if tukuru in moji:
    print("Yes")

else:
    print("No")

Solution (Python):
s = input()
P = input()

s = s * 2
if P in s:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
p = input()
flag = 0
for i in range(len(s)):
    if flag == 1:
        break
    if s[i] == p[0]:
        if len(p) == 1:
            print("Yes")
            flag = 1
            break
        for j in range(1, len(p)):
            i = (i + 1) % len(s)
            if s[i] != p[j]:
                break
            if j == len(p)-1:
                print("Yes")
                flag = 1
                break
if flag == 0:
    print("No")

Solution (Python):
s,p = input()*2,input()
print('Yes' if p in s else 'No')

Solution (Python):
s=input()
p=input()
print("Yes" if p in s+s else "No")

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

Solution (Python):
s, p = input() * 2, input()
print('Yes' if p in s else 'No')

Solution (Python):
r=input()
p=input()
r=r*2
if r.find(p)==-1:
    print("No")
else:
    print("Yes")

Solution (Python):
ring = input()
ring += ring

if input() in ring:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
p = input()
sen = s+s
if p in sen:
    print('Yes')
else:
    print('No')

Solution (Python):


"""
????????°?????????????´¢
"""
s = input().strip()
p = input().strip()
ret = "No"
for i in range(len(s)):
    if p in s:
        ret = "Yes"
        break
    
    s = s[1:] + s[0] 

print(ret)

Solution (Python):
s=[ord(i) for i in input()]
n=[ord(i) for i in input()]
flag=0
flack=0
for i in range(len(s)):
    flack=0
    if n[0]==s[i]:
        flack=1
        for j in range(1,len(n)):
            if i+j>=len(s):
                if n[j]==s[i+j-len(s)]:
                    flack=flack+1
                else:
                    break
            else:
                if n[j]==s[i+j]:
                    flack=flack+1
                else:
                    break
    if flack==len(n):
        flag=1
        break
                
if flag:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
p = input()
ss = s + s
if p in ss:
	print('Yes')
else:
	print('No')

Solution (Python):
from collections import deque

def main():
    S = input()
    P = input()

    s = deque(S)
    n = len(S)
    for _ in range(n):
        s.append(s.popleft())
        if P in ''.join(s):
            ans = 'Yes'
            break
    else:
        ans = 'No'

    print(ans)

main()

Solution (Python):
s = input()
p = input()

S = s+s

index = S.find(str(p))

if index != -1:
    print ("Yes")
else:
    print("No")

Solution (Python):
s=input()
p=input()

s+=s

if p in s:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
p = input()

print( "Yes" if p in s*2 else "No" )

Solution (Python):
s = input()
p = input()

if p in s + s:
	print("Yes")
else:
	print("No")

Solution (Python):
s = input()
s = s * 2
p = input()

for offset in range(len(s) - len(p) + 1):
    if s[offset:offset+len(p)] == p[:]:
        print("Yes")
        break
else:
    print("No")

Solution (Python):
s = input()
p = input()
s += s
if p in s and 2 * len(p) <= len(s):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
p = input()
s2 = s + s
if(p in s2):
    print("Yes")
else:
    print("No")

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

Solution (Python):
text = input()*2
word = input()
if text.find(word) != -1:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()*2
p=input()
if s.find(p) != -1:
  print('Yes')
else:
  print('No')

Solution (Python):
p=input()
s=input()

ret = 'Yes'
try: (p+p).index(s)
except : ret = 'No'
print(ret)

Solution (Python):
string = 2 * raw_input()
search = raw_input()
print 'Yes' if string.count(search) > 0 else 'No'

Solution (Python):


import sys, math, os


PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")


def ring(string, pattern):
    string = string + string
    return string.find(pattern) >= 0

  
string = input().strip()
pattern = input().strip()
print("Yes" if ring(string, pattern) else "No")

Solution (Python):
s = input()
p = input()

if p in (s + s):
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
p = input()
flg = False

for i in range(len(s)):
    s = s[1:] + s[:1]
    if p in s:
        flg = True
        break

if flg:
    print('Yes')
else:
    print('No')

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

Solution (Python):
x=input()
s=x*2

y=input()

if y in s:
    print("Yes")
else:
    print("No")

Solution (Python):
z=input()*2
x=input()
a=z.count(x)

if a>=1:
    print("Yes")
else:
    print('No')

Solution (Python):
data = input()
answer = input()

data = data*3

if answer in data:
	print("Yes")
else:
	print("No")

Solution (Python):
string = input()

string *= 3

if string.find(input()) != -1:
	print("Yes")
else:
	print("No")

Solution (Python):
s = input()
p = input()
Ans = False
cnt = 0

for i in range(len(s)):
    for j in range(len(p)):
        if i + j >= len(s):
            i = -j
        if s[i + j] != p[j]:
            break
        cnt += 1
    if cnt == len(p):
        Ans = True
        break
    cnt = 0

if Ans:
    print('Yes')
else:
    print('No')

Solution (Python):

s = input()
s += s
p = input()

if p in s:
    print("Yes")
else:
    print("No")

Solution (Python):
sample_string = input()
test_string = input()
if test_string in sample_string * 2:
    print("Yes")
else:
    print("No")

Solution (Python):
from itertools import cycle, islice

s = input()
t = input()
u = "".join(islice(cycle(s), len(s)+len(t)))

print("Yes" if u.find(t) >= 0 else "No")

Solution (Python):
s,p=[input() for i in range(2)]
s=s*100
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s,p=[input() for i in range(2)]
s=s*10
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s,p=[input() for i in range(2)]
s=s*5
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s,p=[input() for i in range(2)]
s=s*4
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s,p=[input() for i in range(2)]
s=s*3
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s,p=[input() for i in range(2)]
s=s*2
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
letters=input()
letters=letters+letters
want_find=input()
if want_find in letters:
    print('Yes')
else:
    print('No')

Solution (Python):
word = input()*2
p = input()
if p in word:
    print('Yes')
else:
    print('No')

Solution (Python):
s, p = input()*2, input()
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
str = input() *2
pattern = input()

if pattern in str:
  print("Yes")
else:
  print("No")

Solution (Python):
s = raw_input()
p = raw_input()
s = s + s
if p in s:
    print "Yes"
else:
    print "No"

Solution (Python):
s = input()
p = input()
for e, i in enumerate(s):
    if i == p[0]:
        temp = s[e:] + s[:e]
        if p in temp:
            print('Yes')
            break
else:
    print('No')

Solution (Python):
def main():
    s = input()
    p = input()

    S = list(s)
    P = list(p)

    C = [] 
    f = False
    for x in range(len(S)):
        if P[0] == S[x]:
            C.append(x)
            f = True

    if f == False:
        print("No")
    else:
        Ans = []
        for z in range(len(C)):
            cnt = 0
            for x in range(len(S)):
                if x + C[z] >= len(S):
                    i = x + C[z] - len(S)
                else:
                    i = x + C[z]
                if P[x] == S[i]:
                    cnt += 1
                    if cnt == len(P):
                        break
                else:
                    break

            if cnt == len(P):
                Ans.append(1)
            else:
                Ans.append(0)
        
        if 1 in Ans:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    s = input()
    p = input()

    S = list(s)
    P = list(p)

    C = [] 
    f = False
    for x in range(len(S)):
        if P[0] == S[x]:
            C.append(x)
            f = True

    if f == False:
        print("No")
    else:
        Ans = []
        for z in range(len(C)):
            cnt = 0
            for x in range(len(S)):
                if x + C[z] >= len(S):
                    i = x + C[z] - len(S)
                else:
                    i = x + C[z]
                if P[x] == S[i]:
                    cnt += 1
                    if cnt == len(P):
                        break
                else:
                    break

            if cnt == len(P):
                Ans.append(1)
            else:
                Ans.append(0)
        
        if 1 in Ans:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()

Solution (Python):

"""
import codecs
import sys

sys.stdout = codecs.getwriter("shift_jis")(sys.stdout) 
sys.stdin = codecs.getreader("shift_jis")(sys.stdin) 




"""

s = raw_input()
p = raw_input()




cnt = s.count(p[0]) 
flag = 0
if cnt == -1: 
	print("No")
else: 
	start_search = 0 
	while cnt > 0:
		index = s.find(p[0], start_search) 
		ans = 1
		for i in range(len(p)):
			if index + i >= len(s): 
				j = i - len(s)
			else:
				j = i
			if s[index + j] != p[i]: 
				ans = 0
				break
		if ans == 1:
			print("Yes")
			flag = 1
			break
		start_search = index + 1
		
		cnt -= 1
	if flag == 0:
		print("No")

Solution (Python):

ring = input()
pattern = input()

ring *= 2

if pattern in ring:
    print('Yes')
else:
    print('No')

Solution (Python):
def main():

    string_s = input()
    string_p = input()

    print('Yes') if string_p in (string_s + string_s) else print('No')


main()

Solution (Python):
s=(input())*2
print('Yes' if input() in s else 'No')

Solution (Python):
s = input()
p = input()

s += s
if s.find(p) == -1:
    print('No')
else:
    print('Yes')

Solution (Python):

"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    s = input().strip()
    p = input().strip()

    s = s + s[:-1]
    if p in s:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
s = input() * 2
p = input()

if s.find(p) == -1:
    print('No')
else:
    print('Yes')

Solution (Python):

s = str(input())*2
q = str(input())
print(["No", "Yes"][q in s])

Solution (Python):


def main():

    s = input()
    p = input()

    if(p in s*2):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
s=input()
p=input()
ss=s+s
if ss.find(p)==-1:
    print("No")
else:
    print("Yes")

Solution (Python):
def main():
    s = input()
    p = input()

    
    if p in s + s:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Solution (Python):
s=input()
p=input()
if (s+s).count(p):
    print('Yes')
else:
    print('No')

Solution (Python):
i=input
p=print
x=i()
y=i()
p('Yes') if (x+x).count(y) else p('No')

Solution (Python):
s=input()
p=input()
print('Yes'if p in s*2 else'No')

Solution (Python):
a=input()
print(['No','Yes'][input() in a*2])

Solution (Python):
s,p=input()*2,input()
print(['No','Yes'][p in s])

Solution (Python):
s = input()
s += s

key = input()

if s.find(key) != -1: 
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
if input() in s * 2:
    print('Yes')
else:
    print('No')

Solution (Python):
s = raw_input()
p = raw_input()
s = s + s
if p in s:
	print 'Yes'
else:
	print 'No'

Solution (Python):
s=input();a="";b=input()
for i in range(len(s)):
    a+=s
if b in a:
    print("Yes")
else:
    print("No")

Solution (Python):
ins = input()
pat = input()

arr = ins + ins

if arr.find(pat) != -1:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
s2 = s + s
print("Yes" if s2.find(input()) != -1 else "No")

Solution (Python):
s = input() * 2
print("Yes" if input() in s else "No")

Solution (Python):
words = input()
makeword = input()
words = words + words
if makeword in words:
    print('Yes')
else:
    print('No')

Solution (Python):
S=input()
P=input()
I=S*2
if P in I:
 print('Yes')
else:
 print('No')

Solution (Python):
a=input()
print(['No','Yes'][input()in a*2])

Solution (Python):
s,p=input()*2,input()
print(['No','Yes'][p in s])

Solution (Python):
s = input()
p = input()

if p in (s + s):
    print('Yes')
else:
    print('No')

Solution (Python):

line = str(raw_input()*2)
word = str(raw_input())
if line.count(word):
    print "Yes"
else: print "No"

Solution (Python):

s = raw_input()
p = raw_input()
s += s
if p in s:
    print "Yes"
else:
    print "No"

Solution (Python):
hoge = list()
for _ in range(2):
    hoge.append(input())
hoge[0] = hoge[0] + hoge[0]
if hoge[0].find(hoge[1]) == -1:
    print ('No')
else:
    print ('Yes')

Solution (Python):
str1, str2 = input()*2, input()
if str2 in str1:
    print("Yes")
else:
    print("No")

Solution (Python):
text = input().strip('\n') * 2
pattern = input().strip('\n')
if len(pattern) <= len(text) / 2 and pattern in text:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()*2
p = input()
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

s = sys.stdin.readline().rstrip('\r\n')
p = sys.stdin.readline().rstrip('\r\n')

s += s
if p in s:
  print('Yes')
else:
  print('No')

Solution (Python):



import sys

s = sys.stdin.readline().strip()
p = sys.stdin.readline().strip()

s = s + s

if p in s:
    print('Yes')
else:
    print('No')

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

Solution (Python):
s = input()
p = input()
s += s
if p in s:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
p = input()
if (s*2).count(p) == 0 :
    print('No')
else :
    print('Yes')

Solution (Python):
def judge(s,p):

    sList = list(s)
    pList = list(p)


    for i in range(len(sList)):
        if sList[i] == pList[0]:
            answerNum = 0
            counter = i

            for j in range(len(pList)):
                if pList[j] == sList[counter]:
                    answerNum += 1

                    if answerNum == len(pList):
                        return True
                else:
                    break

                if counter == len(sList) -1 :
                    counter = 0
                else:
                    counter += 1
    return False

if judge(input(),input()):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()
ls = len(s)
s += s[0:len(t)]
f = 0
i = 0
while i < ls:
    if t == s[i:i+len(t)]:
        f = 1
        break
    i += 1
if f == 0:
    print('No')
else:
    print('Yes')

Solution (Python):
def search(pat, s):
    """find a pattern 'pat' in a ring shaped text 's'
    len(s) >= len(p) and both s and p consists of lowercase characters.

    >>> search('a', 'a')
    True
    >>> search('advance', 'vanceknowledgetoad')
    True
    >>> search('advanced', 'vanceknowledgetoad')
    False
    """
    return pat in s + s


def run():
    s1 = input()
    s2 = input()

    if search(s2, s1):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    run()

Solution (Python):
s = input() * 2
p = input()

if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):


s = input()
p = input()

for i in range(len(s)):
    s = s[1:] + s[0:1]
    if s.find(p) != -1:
        print("Yes")
        exit()

print("No")

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

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

Solution (Python):
s = input()
s = s+s
p = input()
if p in s:
    print("Yes")
else:
    print("No")

Solution (Python):
text_list = []

for x in range(2):
    if x != 1:
        text_list.append(input()*2)
    else:
        text_list.append(input())

print('Yes' if text_list[1] in text_list[0] else 'No')

Solution (Python):
I=input;s=I()*2;print(['No','Yes'][I()in s])

Solution (Python):
def main():
    tmp = input()*2
    tmq = input()
    print('Yes' if tmq in tmp else 'No')
main()

Solution (Python):
print((lambda x,y:'Yes'if y in x else'No')(input()*2,input()))

Solution (Python):
s = input()
p = input()
s = s*(len(p)//len(s)+2)

if p in s:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
p = input()
s += s
ans = "No"
for i in range(len(s)//2):
      if s[i] == p[0]:
            for j in range(len(p)):
                  if s[i+j] != p[j]:
                        break
                  if j == len(p)-1:
                        ans = "Yes"
print(ans)

Solution (Python):


import sys

s = sys.stdin.readline().strip()
p = sys.stdin.readline().strip()

s += s

if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):



sent = input()
pat = input()

len_sent = len(sent)
len_pat = len(pat)

flag = False
for i in range(len_sent):
    sent_pat = ''
    if i+len_pat <= len_sent:
        sent_pat = sent[i:i+len_pat]
    else:
        sent_pat = sent[i:len_sent] + sent[0:len_pat - (len_sent - i)]
    if sent_pat == pat:
        flag = True

if flag:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
p = input()
print('Yes' if (p in s*2) else 'No')

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

Solution (Python):
s = str(input())
p = str(input())
case = s + s
if p in case:
	print('Yes')
else:
	print('No')

Solution (Python):
import sys
import math
 
S = raw_input()
S = S*2
 
T = raw_input()
 
if T in S:
    print "Yes"
else:
    print "No"

Solution (Python):
n = input()
n2 = n * 2
x = input()
if x in n2:
    print('Yes')
else: print('No')

Solution (Python):
sentence = input().lower()
ans = input().lower()
doublesentence = sentence + sentence 
print("Yes" if  ans in doublesentence else "No")

Solution (Python):
s=input()
p=input()
s_len=len(s)
p_len=len(p)
s_list=list(s)
p_list=list(p)
i=0;j=0;ans='No'
while i<=s_len:
    for j in range(p_len):
        if s_list[(i+j)%s_len]!=p_list[j]:
            break
    else:
        ans='Yes'
        break
    i+=1
print(ans)

Solution (Python):
s=input()*2
p=input()
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
sen = input()
target = input()

def cilcle(s, n):
    result = ""
    for i in range(n):
        result += sen[i%len(sen)]
    return result

if target in cilcle(sen, len(sen)**2):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input() * 2
p = input()
print("Yes" if s.find(p, 0, len(s) )>= 0 else "No")

Solution (Python):
s = input() * 2
P = input()
if P in s:
    print('Yes')
else:
    print('No')

Solution (Python):


def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    string = input()
    string += string
    p = input()
    
    
    
    if string.find(p) >= 0: print("Yes")
    else: print("No")

if __name__ == "__main__":
    main()

Solution (Python):
n=raw_input()*2
print'Yes' if raw_input() in n else'No'

Solution (Python):
s = input()
p = input()
s = s + s
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
a=input()
b=input()
a=a+a[:-1]
if a.find(b)!=-1:
        print("Yes")
else:
        print("No")

Solution (Python):
s = input() * 2
p = input()
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s = str(input())
p = str(input())

s = s + s
if p in s:
	print("Yes")
else:
	print("No")

Solution (Python):
s = input()
p = input()
s_len = len(s)
p_len = len(p)
for i in range(s_len):
    for j in range(p_len):
        same = True
        if s[(i+j)%s_len] != p[j]:
            same = False
            break
    if same:
        print("Yes")
        exit(0)
print("No")

Solution (Python):
s = input()
p = input()
s = s*2
if s.find(p) == -1:
    print("No")
else:
    print("Yes")

Solution (Python):
s = list(input())
p = list(input())
s += s
for x in range(len(s*2)):
    if p == s[x:x+len(p)]:
        print("Yes")
        break
    else:
        pass
else:
    print("No")

Solution (Python):
s = input()
p = input()
ret = 'No'
tts = s + s[:len(p)]
if p in tts: ret = 'Yes'
print(ret)

Solution (Python):


ring = input()
word = input()

doubleRing = ring * 2
ringCut = doubleRing.split(word)


if ringCut[0] == doubleRing:
    print('No')
else:
    print('Yes')

Solution (Python):
from functools import reduce;s, p = input().strip(), input().strip();
print( "Yes" if reduce(lambda a,b: a or b , [ (s[i:]+s[:i]).find(p) > -1 for i in range(0, len(s)) ] ) else "No" )

Solution (Python):
cir = (str(input()))
cir_l = list(cir)
a = list(cir)
word = str(input())
word_l = list(word)
c = 0
for i in range(len(a)):
    cir_l.append(a[i])
for i in range(len(a)):
    w = ''
    for k in range(len(word_l)):
        w = w + cir_l[i+k]
    if (w == word):
        c = 1
if (c):
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
p = input()
s = s + s
print("Yes" if p in s else"No")

Solution (Python):
s=input()
p=input()
s=s*2
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()
p=input()
s*=2
if s.find(p)!=-1:
    print("Yes")
else :
    print("No")

Solution (Python):
s = input()
p = input()
s += s
if p in s:
	print("Yes")
else:
	print("No")

Solution (Python):
S = str(input())
P = str(input())

is_ok = False

for i in range(len(S)):
    FLG = True
    for k in range(len(P)):
        if S[(i+k)%(len(S))] != P[k]:
            FLG = False
            break

    if FLG == True:
        is_ok = True
        break

if is_ok == True:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
p=input()
print('Yes' if p in s+s else 'No')

Solution (Python):
s=input()
s+=s
p=input()
if p in s:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
p=input()

S=s*2

if p in S:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
p=input()

s=s+s[:-1]

if s.find(p)!=-1:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
p=input()
s*=2
if s.find(p)!=-1:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
p = input()
ss = s + s
if ss.find(p) < 0:
    print("No")
else:
    print("Yes")

Solution (Python):
s = input()
p = input()
S = s + s
if S.find(p) < 0:
    print("No")
else:
    print("Yes")

Solution (Python):
n=input()
N=n*2

a=input()

if a in N:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()
p=input()
if p in s*2:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()*2
p = input()
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()
p=input()
s += s
a = s.count(p)

if a == 0:
    print('No')
else:
    print('Yes')

Solution (Python):


s=input()
p=input()

S=s*2

if p in S:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


S = str(input())
P = str(input())

is_ok = False

for i in range(len(S)):
    FLG = True
    for k in range(len(P)):
        if S[(i+k)%(len(S))] != P[k]:
            FLG = False
            break

    if FLG == True:
        is_ok = True
        break

if is_ok == True:
    print("Yes")
else:
    print("No")

Solution (Python):
import re
s=input()
p=input()
s_s=s+s
match=re.search(p,s_s)
if match:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()*2
t=input()
if t in s:
    print('Yes')
else:
    print('No')

Solution (Python):
a=input()
b=input()
a=a+a[:-1]
if a.find(b)!=-1:
        print("Yes")
else:
        print("No")

Solution (Python):
s = input()
p = input()
if p in s*2:
    print('Yes')
else:
    print('No')

Solution (Python):
s = list(input())
p = list(input())
for x in range(len(p)) :
    s.append(s[x])

i = 0
j = 0
while True :
    if p[j] == s[i] :
        j += 1
        if j == len(p) :
            print("Yes")
            break
        i += 1
        if i == len(s) :
            print("No")
            break
    else :
        i += (1 - j)
        if i == len(s) :
            print("No")
            break
        j = 0

Solution (Python):
s = input();
p = input();

if(p in s + s):
    print("Yes");
else:
    print("No");

Solution (Python):
s = str(input())
p = str(input())
if p[0] not in s:
	print("No")
elif p in s:
	print("Yes")
else:
	for i in range(len(s)):
		s = s[1:] + s[:1]
		if p in s:
			print("Yes")
			break
	else:
		print("No")

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

Solution (Python):
a = input() * 2
b = input()
if b in a:
    print("Yes")
else:
    print("No")

Solution (Python):
x = list(input())
y = list(input())
for a in range(len(y)):
    x.append(x[a])

i = 0
j = 0
while True :
    if y[j] == x[i]:
        j += 1
        if j == len(y):
            print("Yes")
            break
        i += 1
        if i == len(x):
            print("No")
            break
    else :
        i += (1 - j)
        if i == len(x):
            print("No")
            break
        j = 0

Solution (Python):
s=str(input())
p=str(input())
s=s+s
if p in s:
    print("Yes")
else:
    print("No")

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

Solution (Python):
s = input()
p = input()
s += s


if p in s:
   print("Yes")
else:
   print("No")

Solution (Python):
s = input()
p = input()
if p in s+s:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
p = input()
s = s+s
print('Yes' if s.count(p) else 'No')