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):
str1=input()
str2=input()
str=str1*2
if str2 in str:
    print("Yes")
else:
    print("No")

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


if __name__ == '__main__':
    main()

Solution (Python):
def main():

    sentence = input()
    phrase = input()
    count = 0
    for _ in range(len(sentence)):
        if phrase in sentence:
            count =  1
            break
        else:
            sentence = sentence[1:] + sentence[0]
    
    if count == 1:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

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

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

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
a = input()
b = input()
a = a+a
if b in a:
    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()

if len(p) <= len(s) and (s+s).find(p) > -1:
    print("Yes")
else:
    print("No")

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

Solution (Python):
s = raw_input()
p = raw_input()
if p in s+s:
    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()*2
p = input()
print("Yes" if p in s else "No")

Solution (Python):
ring = str(input())*2
search = str(input())

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

Solution (Python):
s = input()
p = input()
Flag = False
for i in range(len(s)):
    if len(s)<len(p):
        print("No")
        break
    for j in range(len(p)):
        if i+j>=len(s):
            if s[i+j-len(s)] != p[j]:break
        elif s[i+j] != p[j]:break
        if j == len(p)-1:
            print("Yes")
            Flag = True
            break
    if Flag:break
    if i == len(s)-1:print("No")

Solution (Python):
from sys import stdin

s = stdin.readline().rstrip()
p = stdin.readline().rstrip()
ss = s*2
if p in ss:
    print("Yes")
else:
    print("No")

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

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

for i in range(len(s)):
	cmp = ''
	for j in range(len(p)):
		cmp += s[(i+j) % len(s)]
	if p == cmp:
		print('Yes')
		exit(0)
print('No')

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

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

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

Solution (Python):
s=input()
p=input()
sl = [i for i in s]
pl = [i for i in p]
lenp=len(p)
pp=pl[-1]
el=[i for i,x in enumerate(sl) if x==pp]
check=0
for i in el:
    pcheck=-1
    while True:
        if sl[i]==pl[pcheck]:
            i-=1
            pcheck-=1
        else:
            break
        if pcheck+lenp<=0:
            check+=1
            break
    if check==1:
        break
if check==0:
    print("No")
else:
    print("Yes")

Solution (Python):
r=input()
a=input()
if a in r+r:
	print('Yes')
else:
	print('No')

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

Solution (Python):
def judg_unit(ss,pp):
    sss = ss + ss + ss
    result = sss.find(pp)
    if result != -1:
        return "Yes"
    else :
        return "No"

s = str(input())
p = str(input())
print(judg_unit(s,p))

Solution (Python):

s1 = input()
s2 = input()

while len(s1) <= 100:
	s1 = s1 + s1

if s2 in s1:
	print("Yes")
else:
	print("No")

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

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

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

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

Solution (Python):
a = input()
b = input()
a = a + a[:-1]
if b in a:
    print('Yes')
else:
    print('No')

Solution (Python):


buf = input()
word = input()
buf_buf = buf + buf

if word in buf_buf:
    print("Yes")
else:
    print("No")

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

if (p in s)==True:
  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 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 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):
n=raw_input()*2
print'Yes' if raw_input() in n else'No'

Solution (Python):
s = input()*2
p = input()
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()
print("Yes" if p in s else "No")

Solution (Python):
I=input;

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

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

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

Solution (Python):
s = raw_input()
p = raw_input()
ss = s + s
ps = p[0]
ret = 'No'
for i in range(len(s)):
    if s[i] == ps:
        c = 0
        for k in range(len(p)):
            if ss[i+k] == p[k]:
                c = c + 1
        if c == len(p):
            ret = 'Yes'
print ret

Solution (Python):


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

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

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

Solution (Python):
s = raw_input()
new_s = s + s

p = raw_input()


if p in new_s:
	print "Yes"
else:
	print "No"

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

Solution (Python):
s = raw_input()
p = raw_input()
i = 0
while i<len(s):
	k = 0
	while k < len(p):
		if s[(i+k)%len(s)] == p[k]:
			k += 1
		else:
			break
	if k >= len(p):
		print 'Yes'
		break
	i += 1
if k < len(p):
	print 'No'

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

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

Solution (Python):
s=raw_input()
s+=s
print ['No','Yes'][s.find(raw_input())>=0]

Solution (Python):
s=raw_input()*2
print ['No','Yes'][s.find(raw_input())>=0]

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

s3 = s + s + s

if p in s3:
    print 'Yes'
else:
    print 'No'

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

hits=[]
for j in range(len(s)):
    if p[0] == s[j]:
        hits.append(j)


flg=False
_i = 0
for _j in hits:
    if flg: break
    j=_j
    while True:
        for idx, i in enumerate(range(_i, len(p))):
            if j + i > len(s) -1:
                break 
            if p[i] == s[j+idx]:
                flg=True
            else:
                flg=False
                break
        else:
            break

        if flg:
            j = 0
            _i = i
        else:
            break

if flg:
    print "Yes"
else:
    print "No"

Solution (Python):
import sys
s1=raw_input()
s2=raw_input()

for idx, s in enumerate(s1):
    if s2[0] != s:
        continue
    
    s1_idx = idx
    s2_idx = 0
    while True:
        s1_now = s1[s1_idx:]
        s2_now = s2[s2_idx:]
        if len(s1_now) >= len(s2_now):
            if s1_now.startswith(s2_now):
                print "Yes"
                sys.exit(0)
            else:
               break
        else:
            if s2_now.startswith(s1_now):
                s1_idx = 0
                s2_idx += len(s1_now)
            else:
                break

print "No"

Solution (Python):
import sys
s1=raw_input()
s2=raw_input()

def check(s1_top, s1, s2):
    for s2_idx, c in enumerate(s2):
        if c != s1[(s1_top + s2_idx) % len(s1)]:
            return False
    return True

l=[]    
for i, c in enumerate(s1):
    if c == s2[0]:
        if check(i, s1, s2):
            print "Yes"
            sys.exit(0)

print "No"

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

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

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

Solution (Python):
source = input() * 2
target = input()

if source.find(target) == -1:
    print('No')
else:
    print('Yes')

Solution (Python):
source = input() * 2
target = input()

if source.find(target) == -1:
    print('No')
else:
    print('Yes')

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

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

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

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

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

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

Solution (Python):
import sys
s = sys.stdin.readline().strip()
p = sys.stdin.readline().strip()
if (s + s).find(p) == -1:
    print("No")
else:
    print("Yes")

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

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

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

Solution (Python):


import re
s = input()
p = input()

if re.search(p , s * 2):
    print('Yes')
else:
    print('No')

Solution (Python):


s,p = [input() for i in range(2)]

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

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

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

Solution (Python):
import sys

s = sys.stdin.readline().rstrip()
s += s
pstr = sys.stdin.readline().rstrip()
if  pstr in s:
	print( "Yes" )
else:
	print( "No" )

Solution (Python):
import sys

s = sys.stdin.readline().rstrip()
s += s
pstr = sys.stdin.readline().rstrip()
if  pstr in s:
	print( "Yes" )
else:
	print( "No" )

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

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

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

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

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

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

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

Solution (Python):
S = raw_input()
P = raw_input()
no_flg = True
count = S.count(P[0])
start = 0
for c in range(count):
    i = 1
    if c > 0:
        start = S[(start+1):].index(P[0]) + (start+1)
    else:
        start = S[start:].index(P[0])
    for p in P[1:]:
        if S[(start+i) % len(S)] != p:
            break
        i += 1
    if i == len(P):
        print 'Yes'
        no_flg = False
        break
if no_flg:
    print 'No'

Solution (Python):
s = raw_input()
s_2 = ''
judge = 0
p = raw_input()
for i in range(len(s)):
	s_list = list(s)
	if list(s)[i] == list(p)[0]:
		s_list.extend(s_list[0:i])
		del s_list[0:i]
		s_2 = "".join(s_list)
		if p in s_2:
			judge = 1
if judge :
	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()
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")

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

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

Solution (Python):
s = raw_input()
p = raw_input()
idx = []
for i in range(0,len(s)):
    if s[i] == p[0]:
        idx.append(i)
for i in idx:
    for j in range(0,len(p)):
        if p[j] == s[(i+j)%len(s)]:
            continue
        else:
            break
    else:
        print 'Yes'
        break
else:
    print 'No'

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

Solution (Python):
ringstr = raw_input()
matchstr = raw_input()

ringstrlen = len(ringstr)
matchstrlen = len(matchstr)
x = 0 
y = 0 
hitflag = False
finflag = False
while True:
    if x == matchstrlen:
        print "Yes"
        break
    if y == ringstrlen:
        y=0
        finflag =True
    if matchstr[x]==ringstr[y]:
        x+=1
        if not hitflag:
            tmpy = y
            hitflag = True
        y+=1
    else:
        if hitflag:
            hitflag = False
            if finflag:
                print "No"
                break
            x=0
            y=tmpy+1
            continue
        else:
            if y == ringstrlen-1:
                print "No"
                break
            y+=1

Solution (Python):
def myfindall(s,ps):
    
    matchlist =[]
    while True:
        tmp = s.find(ps)
        if tmp < 0 :
            break
        if len(matchlist)>0:
            matchlist.append(tmp+matchlist[-1]+1)
        else:
            matchlist.append(tmp)
        s = s[tmp+1:]
    return matchlist

instr = raw_input()
findstr = raw_input()
matchlist = myfindall(instr,findstr[0])
matchflag = False
y=0
for x in matchlist:
    if matchflag:
        break
    while True:
        if y >= len(findstr):
            print "Yes"
            matchflag = True
            break
        if x >= len(instr):
            x = 0
        if instr[x]==findstr[y]:
            x+=1
            y+=1
        else:
            y=0
            break
if not matchflag:
    print "No"

Solution (Python):



s = input()
p = input()

s_length = len(s)
ans = False


for s_index in range(len(s)):
    flag = True
    for p_index in range(len(p)):
        target_index = (s_index + p_index) % len(s)
        if s[target_index] != p[p_index]:
            flag = False
            break
    if flag:
        ans = True
        break

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

Solution (Python):
s = raw_input()

p = raw_input()

flag = 0
for i in range (len(s)):
    flag = 0
    for j in range(len(p)):
        if p[j] == s[(i + j) % len(s)]:
            flag += 1

        if flag == len(p):
            break

    if flag == len(p):
        break

if flag == len(p):
    print "Yes"
else:
    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):
word = []
for i in range(2):
    word.append(raw_input())

num = word[0] + word[0]

if word[1] in num:
    print "Yes"
else:
    print "No"

Solution (Python):
String = input()
A=input()
String+=String[0:len(A)]

for i in range(len(String)-len(A)+1):
	if String[i:i+len(A)] == A:
		print("Yes")
		break
else: print("No")

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

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

s += s

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

Solution (Python):


s = raw_input()
s += s
p = raw_input()

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

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

Solution (Python):
a = raw_input()
b = raw_input()
a = a+a
if 0 < a.count(b):
    print 'Yes'
else:
    print 'No'

Solution (Python):
a = raw_input()
b = raw_input()
a = a+a
if 0 <= a.find(b):
    print 'Yes'
else:
    print 'No'

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

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

Solution (Python):
str1 = raw_input()
str2 = raw_input()
n = len(str1)

for i in xrange(n):
    j = i
    s = 0
    for k in xrange(len(str2)):
        if (j+k) > (n-1):
            j = -k
        if str1[j+k] != str2[k]:
            s += 1
    if s == 0:
        print "Yes"
        break
else:
    print "No"

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

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

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

Solution (Python):


s = list(input())

p = list(input())

s = s + s


flag = 0
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:
                flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

Solution (Python):





























import re

pattern=[]

s=input()
p=input()

s= s+s








matchOB = re.search(p, s)

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

Solution (Python):
import re
s=input()
p=input()
n=len(s)
pp='.*'.join(list(p))
print('Yes' if any([re.search(p,s[i:n]+s[0:i]) for i in range(0,n)]) else 'No')

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


if p in s:
    print("Yes")

else:
    s_list = list(s)
    len_s = len(s)
    len_p = len(p)
    string = ''
    
    string = string.join(s_list[(len_s - len_p):len_s] + s_list[0:len_p])
    
    if p in string:
        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()
 
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()
result="No"
for i in range(len(s)):
    r=s[i:]+s[:i]
    if r[0:len(p)]==p:
        result="Yes"
        break
print(result)

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):
import sys
import math

S = raw_input()
if S[len(S)-1] == "\r":
    S = S[:len(S)-1]
S = S*2

T = raw_input()
if T[len(T)-1] == "\r":
    T = T[:len(T)-1]

if T in S:
    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()
print('Yes' if p in s+s else 'No')

Solution (Python):
string = input()
string = string*2
if string.count(input()):
	print("Yes")
else:
	print("No")

Solution (Python):
s=raw_input()
ring=s*2
target=raw_input()
f=0

for i in range(len(s)):
	if ring[i:i+len(target)]==target:
		f=1
		break
if f==1:
	print "Yes"
else:
	print "No"

Solution (Python):
s=raw_input()
target=raw_input()
ring=s+s[0:len(target)]
f=0

for i in range(len(s)):
	if ring[i:i+len(target)]==target:
		f=1
		break
if f==1:
	print "Yes"
else:
	print "No"

Solution (Python):
s=raw_input()
target=raw_input()
ring=s*2
f=0

for i in range(len(s)):
	if ring[i:i+len(target)]==target:
		f=1
		break
if f==1:
	print "Yes"
else:
	print "No"

Solution (Python):
s=raw_input()
target=raw_input()
ring=s*2

ans="No"
for i in range(len(s)):
	if ring[i:i+len(target)]==target:
		ans="Yes"
		break
print ans

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

Solution (Python):
s=raw_input()
target=raw_input()
ring=s*2

ans="No"
for i in range(len(s)):
	if ring[i:i+len(target)]==target:
		ans="Yes"
		break
print ans

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

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

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

flag = False
for i in range(len(s)):
    t = s[i:] + s[:i]
    if p in t :
        flag = True
        break

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

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

str2 = s + s
if str2.find(p) >= 0:
	print("Yes")
else:
	print("No")

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

Solution (Python):
ring = input()
ring_double = ring *2
test = input()
if test in ring_double:
	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()
s += s
if p in s:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
P = input()
e = s + s
x = len(P)
m = 0
count = 0
for i in range(len(s)):
    if P == e[m:x]:
        count += 1
    m += 1
    x += 1
if count >= 1:
    print("Yes")
else:
    print("No")

Solution (Python):
a = input()
b = input()
c = "No"
for i in range(0,len(a)):
    if len(b) > len(a[i:i+len(b)]):
        n = len(b) - len(a[i:i+len(b)])
        if a[i:i+len(b)] + a[0:n] == b:
            c = "Yes"
    else:
        if a[i:i+len(b)] == b:
            c ="Yes"
print(c)

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 *= 2

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()

s *= 2

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()

s *= 2

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

Solution (Python):
s = input()
p = input()
 
s += s[:len(p)]
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 *= 2

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()

s *= 2

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

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

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

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

if (s * 2).find(p) >= 0:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
s = input()
p = input()
for i in range(len(s)):
    if i + len(p) <= len(s):
        t = s[i:i + len(p)]
    else:
        t = s[i:] + s[:i + len(p) - len(s)]
    if t == p:
        print('Yes')
        break
else:
    print('No')

Solution (Python):

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

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

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

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

Solution (Python):
def check(s, p):
    for i in range(len(s)):
        count = 0
        for j in range(len(p)):
            if s[(i+j) % len(s)] != p[j]:
                break
            count += 1
        if count == len(p):
            return True
    return False

s = raw_input()
p = raw_input()
flag = check(s, p)
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
given = input()
target = given*2

keyword = input()

if keyword in target:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
wor = raw_input()
word = raw_input()
a = [[wor]for i in range(10)]
b = ""
for i in a:
    b = b + "".join(i)


if b.count(word) > 0:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
s = input()
p = input()
s += s[0:len(p) - 1]
if s.find(p) >= 0:
    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()
if p in s*2:
    print('Yes')
else:
    print('No')

Solution (Python):
ring = raw_input() * 2
word = raw_input()

flag = 0
counter = 0
while counter < len(ring)/2:
    if ring[counter:(counter + len(word))] == word:
        flag = 1
        break
    counter += 1

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

Solution (Python):
ring = raw_input() * 2
word = raw_input()

flag = 0
counter = 0
while counter < len(ring)/2:
    if ring[counter:(counter + len(word))] == word:
        flag = 1
        break
    counter += 1

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

Solution (Python):
ring = raw_input() * 2
word = raw_input()

if ring.find(word) != -1:
    print("Yes")
else:
    print("No")

Solution (Python):
ring = raw_input() * 2
word = raw_input()

if ring.find(word) != -1:
    print("Yes")
else:
    print("No")

Solution (Python):
ring = raw_input() * 2
word = raw_input()

if ring.find(word) != -1:
    print("Yes")
else:
    print("No")

Solution (Python):
ring = raw_input() * 2
word = raw_input()

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

Solution (Python):
ring = raw_input() * 2
word = raw_input()

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

Solution (Python):
ring = raw_input() * 2
word = raw_input()

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

Solution (Python):
ring = raw_input() * 2
word = raw_input()

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

Solution (Python):
ring = raw_input() * 2

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

Solution (Python):
ring = raw_input() * 2

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

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

Solution (Python):
if __name__ == '__main__':
    s_txt = input()
    p_txt = input()

    base_txt = s_txt * 2
    base_txt = base_txt[:-1]  

    if p_txt in base_txt:
        print('Yes')
    else:
        print('No')

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

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

s += s[:len(p)-1]
if s.find(p) >= 0:
  print('Yes')
else:
  print('No')

Solution (Python):
import sys

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

if (p in s+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()
p=input()
print('Yes' if p in s*2 else 'No')

Solution (Python):
s=input()
s+=s
s=list(s)
p=list(input())
def solve(s,p):
	i=0
	while i<len(s):
		if s[i:i+len(p)]==p:
			return("Yes")
		i+=1
	return("No")
print(solve(s,p))

Solution (Python):
s=raw_input()
p=raw_input()
s=s*2
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() * 2
p = input()
if s.find(p) >= 0:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
p = input()
found = False
for i in range(len(s)):
    ring = s[i:] + s[:i]
    if p in ring:
        print('Yes')
        found = True
        break
if not found:
    print('No')

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

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

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

Solution (Python):
s1 = input()
s2 = input()

if s2 in s1+s1:
    print("Yes")
else:
    print("No")

Solution (Python):


s=input()*2
target = input()
print("Yes" if target in s else "No")

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

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

slen = len(s)
plen = len(p)
flag = False

for i in xrange(len(s)):
    j = 0
    while(j < plen and s[(i+j)%slen] == p[j]):
        j += 1
    if (j == plen):
        flag = True

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

Solution (Python):
x = str(input())
y = str(input())

s = []
for i in x:
    s.append(i)
p = []
for i in y:
    p.append(i)

n = len(p)
flag = 0
for i in range(len(s)):
    if i+n > len(s):
        if s[i:]+s[0:(i+n)%len(s)] == p:
            print('Yes')
            flag = 1
            break
    else:
        if s[i:i+n] == p:
            print('Yes')
            flag = 1
            break

if flag == 0:
    print('No')

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

s += s

if s.count(p):
    print("Yes")
else:
    print("No")

Solution (Python):
'''
ITP-1_8-D
 ????????°
???????????????????????°??¶???????????? ss ???????????????????????????????¨????????????£?¶????????????????????????????????????§???
????????? pp ??????????????????????????????????????°????????????????????????????????????
???Input
????????????????????? ss ????????????????????????
????????????????????? pp ????????????????????????
???Output
pp  ??????????????´?????? Yes ??¨?????????????????´?????? No ??¨????????????????????????????????????
'''

x = str(input())
y = str(input())

xString = []
for i in x:
    xString.append(i)
yString = []
for i in y:
    yString.append(i)

n = len(yString)
flag = 0
for i in range(len(xString)):
    if xString[i:i+n] == yString:
        flag = 1
        break

    if i+n > len(xString):
        if xString[i:]+xString[0:(i+n)%len(xString)] == yString:
            flag = 1
            break


if flag == 0:
    print('No')
elif flag == 1:
    print('Yes')

Solution (Python):
import sys

lines = [line.strip() for line in sys.stdin]
s = lines[0] + lines[0]
p = lines[1].strip()

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

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

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