from bisect import bisect_left

b,k,l,q=input(),0,2,[]

for i in b:

if l!=i:

l=i

q.append(k)

k+=1

print(q)

for t in range(eval(input())):

a=list(map(int,input().split()))

a.sort()

s,e=a

if s==e:

print('Yes')

else:

print(s, e)

m,n=bisect_left(q,s),bisect_left(q,e)

print(m,n)

if m >= len(q) or q[m] > s:

m-=1

if n >= len(q) or q[n] > e:

n-=1

if m == n:

print('Yes')

else:

print('No')


왜 타임아웃이 발생하는지 노이해염.