Let's call two strings s and t anagrams of each other if it is possible to rearrange symbols in the string s to get a string, equal to t.

Let's consider two strings s and t which are anagrams of each other. We say that t is a reducible anagram of s if there exists an integer k ≥ 2 and 2k non-empty strings s_1, t_1, s_2, t_2, ..., s_k, t_k that satisfy the following conditions:

  1. If we write the strings s_1, s_2, ..., s_k in order, the resulting string will be equal to s; 
  2. If we write the strings t_1, t_2, ..., t_k in order, the resulting string will be equal to t; 
  3. For all integers i between 1 and k inclusive, s_i and t_i are anagrams of each other. 



If such strings don't exist, then t is said to be an irreducible anagram of s. Note that these notions are only defined when s and t are anagrams of each other.

For example, consider the string s =  "gamegame". Then the string t =  "megamage" is a reducible anagram of s, we may choose for example s_1 =  "game", s_2 =  "gam", s_3 =  "e" and t_1 =  "mega", t_2 =  "mag", t_3 =  "e":

<image>

On the other hand, we can prove that t =  "memegaga" is an irreducible anagram of s.

You will be given a string s and q queries, represented by two integers 1 ≤ l ≤ r ≤ |s| (where |s| is equal to the length of the string s). For each query, you should find if the substring of s formed by characters from the l-th to the r-th has at least one irreducible anagram.

Input

The first line contains a string s, consisting of lowercase English characters (1 ≤ |s| ≤ 2 ⋅ 10^5).

The second line contains a single integer q (1 ≤ q ≤ 10^5) — the number of queries.

Each of the following q lines contain two integers l and r (1 ≤ l ≤ r ≤ |s|), representing a query for the substring of s formed by characters from the l-th to the r-th.

Output

For each query, print a single line containing "Yes" (without quotes) if the corresponding substring has at least one irreducible anagram, and a single line containing "No" (without quotes) otherwise.

Examples

Input


aaaaa
3
1 1
2 4
5 5


Output


Yes
No
Yes


Input


aabbbbbbc
6
1 2
2 4
2 2
1 9
5 7
3 5


Output


No
Yes
Yes
Yes
No
No

Note

In the first sample, in the first and third queries, the substring is "a", which has itself as an irreducible anagram since two or more non-empty strings cannot be put together to obtain "a". On the other hand, in the second query, the substring is "aaa", which has no irreducible anagrams: its only anagram is itself, and we may choose s_1 =  "a", s_2 =  "aa", t_1 =  "a", t_2 =  "aa" to show that it is a reducible anagram.

In the second query of the second sample, the substring is "abb", which has, for example, "bba" as an irreducible anagram.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Constructive algorithms

String algorithms

Sorting

Amortized analysis

Data structures


Solutions:
s = input()
mp = [[0 for i in range(26)] for _ in range(len(s))]
for i in range(len(s)):
	mp[i][ord(s[i]) - ord('a')] += 1
	if i > 0:
		for j in range(26):
			mp[i][j] += mp[i - 1][j]
for _ in range(int(input())):
	(l, r) = map(int, input().split())
	sc = 0
	for i in range(26):
		t = mp[r - 1][i]
		if l > 1:
			t -= mp[l - 2][i]
		if t:
			sc += 1
	if s[l - 1] != s[r - 1] or l == r or sc >= 3:
		print('Yes')
	else:
		print('No')


import string

def solve():
	s = input()
	n = int(input())
	alphabets = len(string.ascii_lowercase)
	count = [[0] * alphabets for _ in range(len(s) + 1)]
	for (i, c) in enumerate(s, 1):
		count[i][ord(c) - ord('a')] += 1
		for c in range(alphabets):
			count[i][c] += count[i - 1][c]

	def query(l, r):
		if l == r:
			return 'Yes'
		if s[l - 1] != s[r - 1]:
			return 'Yes'
		unique = 0
		for (x, y) in zip(count[l - 1], count[r]):
			if y - x > 0:
				unique += 1
				if unique > 2:
					return 'Yes'
		return 'No'
	for _ in range(n):
		print(query(*map(int, input().split())))
solve()


sl = list(input())
from collections import defaultdict
dic = defaultdict(list)
for (idx, s) in enumerate(sl):
	dic[s].append(idx)
import bisect
q = int(input())
alpha = set(sl)
for _ in range(q):
	(l, r) = map(int, input().split())
	if sl[l - 1] != sl[r - 1]:
		print('Yes')
	elif l == r:
		print('Yes')
	else:
		cnt = 0
		for a in alpha:
			i1 = bisect.bisect_left(dic[a], l - 1)
			i2 = bisect.bisect_right(dic[a], r - 1)
			if i1 != i2:
				cnt += 1
		if cnt <= 2:
			print('No')
		else:
			print('Yes')


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def solve(s, queries):
	N = len(s)
	charcount = [[0 for _ in range(N + 1)] for _ in range(26)]
	for (i, v) in enumerate(s):
		for ch in range(26):
			charcount[ch][i + 1] = charcount[ch][i]
		ch = ord(v) - ord('a')
		charcount[ch][i + 1] += 1
	ans = []
	for (l, r) in queries:
		if l == r:
			ans.append(True)
		elif s[l] != s[r]:
			ans.append(True)
		else:
			c = 0
			for ch in range(26):
				c += 1 if charcount[ch][r + 1] - charcount[ch][l] > 0 else 0
			ans.append(True if c > 2 else False)
	print('\n'.join(['Yes' if v else 'No' for v in ans]))
s = input()
nq = int(input())
queries = []
for i in range(nq):
	(l, r) = map(int, input().split())
	queries.append((l - 1, r - 1))
solve(s, queries)


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
s = st()
q = val()
cnt = Counter()
l = []
for i in s:
	cnt[i] += 1
	l.append(cnt.copy())
for i in range(q):
	(a, b) = li()
	print('Yes' if a == b or len(l[b - 1] - l[a - 1]) > 2 or s[a - 1] != s[b - 1] else 'No')


s = input()
m = []
for i in range(len(s) + 1):
	m.append([])
	for j in range(26):
		m[-1].append(0)
for i in range(len(s)):
	for j in range(26):
		if j == ord(s[i]) - 97:
			m[i + 1][j] = m[i][j] + 1
		else:
			m[i + 1][j] = m[i][j]
q = int(input())
for _ in range(q):
	(l, r) = map(int, input().split())
	if l == r:
		print('Yes')
		continue
	count = 0
	for i in range(26):
		if m[l - 1][i] != m[r][i]:
			count += 1
	if count == 1:
		print('No')
	elif count >= 3:
		print('Yes')
	elif s[l - 1] == s[r - 1]:
		print('No')
	else:
		print('Yes')


from bisect import *
s = input()
arr = [[] for i in range(26)]
length = len(s)
for i in range(length):
	arr[ord(s[i]) - 97].append(i + 1)
q = int(input())
for i in range(q):
	(l, r) = input().split()
	l = int(l)
	r = int(r)
	if s[l - 1] != s[r - 1] or l == r:
		print('Yes')
	else:
		count = 0
		for j in range(26):
			ind_l = bisect_left(arr[j], l)
			ind_r = bisect_left(arr[j], r)
			if ind_l != ind_r:
				count += 1
			elif ind_l <= len(arr[j]) - 1 and ind_l >= 0 and (ind_r <= len(arr[j]) - 1) and (ind_r >= 0):
				if arr[j][ind_l] == l or arr[j][ind_r] == r:
					count += 1
		if count >= 3:
			print('Yes')
		else:
			print('No')


import io
import os
from collections import Counter, defaultdict, deque
alpha = 'abcdefghijklmnopqrstuvwxyz'
assert len(alpha) == 26

def solve(S, Q, queries):
	lettersToPref = [[0] for i in range(26)]
	for (i, x) in enumerate(S):
		for (i, c) in enumerate(alpha):
			if c == x:
				lettersToPref[i].append(lettersToPref[i][-1] + 1)
			else:
				lettersToPref[i].append(lettersToPref[i][-1] + 0)
	ans = []
	for (l, r) in queries:
		r += 1
		if r - l == 1:
			ans.append('Yes')
			continue
		numUnique = 0
		for i in range(26):
			count = lettersToPref[i][r] - lettersToPref[i][l]
			if count:
				numUnique += 1
		assert r - l > 1
		if numUnique == 1:
			ans.append('No')
			continue
		assert numUnique >= 2
		if S[l] != S[r - 1]:
			ans.append('Yes')
			continue
		assert S[l] == S[r - 1]
		if numUnique >= 3:
			ans.append('Yes')
			continue
		ans.append('No')
	return '\n'.join(ans)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
S = input().decode().rstrip()
(Q,) = [int(x) for x in input().split()]
queries = [[int(x) - 1 for x in input().split()] for i in range(Q)]
ans = solve(S, Q, queries)
print(ans)


s = input()
n = len(s)
dp = [[0] * 26 for _ in range(n + 1)]
for i in range(1, n + 1):
	dp[i] = dp[i - 1].copy()
	dp[i][ord(s[i - 1]) - ord('a')] += 1
for _ in range(int(input())):
	(l, r) = map(int, input().split())
	l -= 1
	k = [dp[r][i] - dp[l][i] for i in range(26)]
	c = sum((p != 0 for p in k))
	k1 = 0
	k2 = 0
	for j in k:
		if j:
			k1 = j
		k2 += j
	if c > 2 or l + 1 == r or (c == 2 and s[l] != s[r - 1]):
		print('Yes')
	else:
		print('No')


ALPHA = 26

def unique(cnt, l, r):
	sum = 0
	for (a, b) in zip(cnt[l - 1], cnt[r]):
		sum += a < b
	return sum
s = list(map(lambda c: ord(c) - ord('a'), list(input())))
cnt = [[] for i in range(len(s) + 1)]
cnt[0] = [0 for j in range(ALPHA)]
for i in range(len(s)):
	cnt[i + 1] = cnt[i].copy()
	cnt[i + 1][s[i]] += 1
n = int(input())
for i in range(n):
	(l, r) = map(int, input().split())
	if l == r or s[l - 1] != s[r - 1] or unique(cnt, l, r) >= 3:
		print('Yes')
	else:
		print('No')


def Input():
	tem = input().split()
	ans = []
	for it in tem:
		ans.append(int(it))
	return ans
s = input()
n = len(s)
suf = [[0] * 26 for i in range(n + 1)]
for i in range(n):
	for j in range(26):
		suf[i + 1][j] = suf[i][j]
	suf[i + 1][ord(s[i]) - ord('a')] += 1
m = Input()[0]
for i in range(m):
	(l, r) = Input()
	if l == r:
		print('Yes')
	else:
		cnt = 0
		for j in range(26):
			if suf[r][j] - suf[l - 1][j] > 0:
				cnt += 1
		if s[r - 1] == s[l - 1] and cnt <= 2:
			print('No')
		else:
			print('Yes')


import sys
s = list(sys.stdin.readline())[:-1]
t = int(sys.stdin.readline())
dic = [[0 for _ in range(26)]]
n = len(s)
for i in range(n):
	temp = [i for i in dic[-1]]
	temp[ord(s[i]) - 97] += 1
	dic.append(temp)
for _ in range(t):
	(l, r) = map(int, sys.stdin.readline().split())
	if l == r:
		print('Yes')
	elif s[l - 1] != s[r - 1]:
		print('Yes')
	else:
		(x, y) = (dic[l - 1], dic[r])
		a = [0 for _ in range(26)]
		for i in range(26):
			a[i] = y[i] - x[i]
		count = 0
		for i in range(26):
			if a[i] > 0:
				count += 1
		if count >= 3:
			print('Yes')
		else:
			print('No')


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
S = [ord(c) - 97 for c in input()]
N = len(S)
acc = list2d(26, N + 1, 0)
for (i, c) in enumerate(S):
	acc[c][i + 1] += 1
for c in range(26):
	acc[c] = list(accumulate(acc[c]))
for _ in range(INT()):
	(l, r) = MAP()
	l -= 1
	ln = r - l
	if ln == 1:
		Yes()
		continue
	cnt = 0
	for c in range(26):
		if acc[c][r] - acc[c][l] >= 1:
			cnt += 1
	if cnt >= 3:
		Yes()
		continue
	if S[l] != S[r - 1]:
		Yes()
	else:
		No()


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
s = input()
pref = defaultdict(dict)
pref[0] = {s[0]: 1}
for j in range(1, len(s)):
	pref[j] = pref[j - 1].copy()
	pref[j][s[j]] = pref[j].get(s[j], 0) + 1
q = int(input())
for i in range(q):
	(l, r) = map(int, input().split())
	if l == r or s[l - 1] != s[r - 1]:
		print('Yes')
		continue
	c = 0
	if l == 1:
		c = len(pref[r - 1])
	else:
		for j in pref[r - 1]:
			if pref[l - 2].get(j, 0) < pref[r - 1][j]:
				c += 1
	if c > 2:
		print('Yes')
	else:
		print('No')


from sys import stdin

def main():
	ss = input()
	counts = [[0] * 26]
	for s in ss:
		counts.append(counts[-1].copy())
		counts[-1][ord(s) - ord('a')] += 1
	q = int(input())
	for _ in range(q):
		(l, r) = map(int, input().split())
		cdifc = 0
		for i in range(26):
			if counts[l - 1][i] != counts[r][i]:
				cdifc += 1
		if l == r:
			print('Yes')
		elif ss[l - 1] == ss[r - 1] and cdifc < 3:
			print('No')
		else:
			print('Yes')
main()


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import *
getcontext().prec = 25
MOD = pow(10, 9) + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
a = input()
alp = [[0] * 26 for i in range(len(a) + 1)]
for i in range(1, len(a) + 1):
	for j in range(26):
		alp[i][j] = alp[i - 1][j]
	alp[i][ord(a[i - 1]) - ord('a')] += 1
for j in range(int(input())):
	(l, r) = map(int, input().split())
	if l - r == 0:
		print('YES')
	elif a[r - 1] != a[l - 1]:
		print('YES')
	else:
		c = 0
		for i in range(26):
			s = alp[r][i]
			s2 = alp[l - 1][i]
			if s - s2:
				c += 1
		if c > 2:
			print('YES')
		else:
			print('NO')


import sys
import math
from collections import defaultdict, Counter
s = input()
pref = defaultdict(dict)
pref[0] = {s[0]: 1}
for j in range(1, len(s)):
	pref[j] = pref[j - 1].copy()
	pref[j][s[j]] = pref[j].get(s[j], 0) + 1
q = int(input())
for i in range(q):
	(l, r) = map(int, input().split())
	if l == r or s[l - 1] != s[r - 1]:
		print('Yes')
		continue
	c = 0
	if l == 1:
		c = len(pref[r - 1])
	else:
		for j in pref[r - 1]:
			if pref[l - 2].get(j, 0) < pref[r - 1][j]:
				c += 1
	if c > 2:
		print('Yes')
	else:
		print('No')


s = str(input())
q = int(input())
n = len(s)
sum_ = [[0] * 26 for _ in range(n + 1)]
for i in range(1, n + 1):
	for j in range(26):
		sum_[i][j] = sum_[i - 1][j]
	sum_[i][ord(s[i - 1]) - ord('a')] += 1
for _ in range(q):
	(l, r) = map(int, input().split())
	(l, r) = (l - 1, r - 1)
	if l == r:
		print('Yes')
		continue
	else:
		cnt = 0
		for i in range(26):
			if sum_[r + 1][i] - sum_[l][i] > 0:
				cnt += 1
	if cnt >= 3:
		print('Yes')
	elif cnt == 1:
		print('No')
	elif s[r] != s[l]:
		print('Yes')
	else:
		print('No')


s = input()
n = len(s)
memo = [None] * (n + 1)
count = [0] * 26
memo[0] = count.copy()
for (i, char) in enumerate(s):
	count[ord(char) - 97] += 1
	memo[i + 1] = count.copy()

def f():
	(l, r) = [int(char) for char in input().split()]
	if l == r:
		return 'Yes'
	if s[r - 1] != s[l - 1]:
		return 'Yes'
	kinds = 0
	seg = [memo[r][k] - memo[l - 1][k] for k in range(26)]
	for c in seg:
		if c:
			kinds += 1
	if kinds >= 3:
		return 'Yes'
	return 'No'
T = int(input())
for t in range(T):
	print(f())


s = input()
n = len(s)
prefix_letter_occurence = [[0 for i in range(n + 1)] for i in range(26)]
for i in range(1, n + 1):
	cur_letter = s[i - 1]
	for l in range(26):
		prefix_letter_occurence[l][i] = prefix_letter_occurence[l][i - 1] + int(l == ord(cur_letter) - 97)

def has_inreducible(l, r):
	if l == r:
		return 'Yes'
	non_zeroes = 0
	for letter in range(26):
		let_count = prefix_letter_occurence[letter][r] - prefix_letter_occurence[letter][l - 1]
		non_zeroes += int(let_count > 0)
	if non_zeroes == 1:
		return 'No'
	elif non_zeroes >= 3:
		return 'Yes'
	elif s[l - 1] != s[r - 1]:
		return 'Yes'
	else:
		return 'No'
q = int(input())
for _ in range(q):
	(l, r) = map(int, input().split())
	print(has_inreducible(l, r))


s = input()
q = int(input())
N = len(s)
prefix_sum = []
for i in range(N + 1):
	prefix_sum.append([0] * 26)
for (i, ch) in enumerate(s, start=1):
	tmp = ord(ch) - ord('a')
	for j in range(26):
		if tmp == j:
			prefix_sum[i][j] = prefix_sum[i - 1][j] + 1
		else:
			prefix_sum[i][j] = prefix_sum[i - 1][j]
for case in range(q):
	(l, r) = list(map(int, input().split()))
	if l == r:
		print('Yes')
		continue
	if s[l - 1] != s[r - 1]:
		print('Yes')
	else:
		sum_ch = 0
		for i in range(26):
			if prefix_sum[r][i] - prefix_sum[l - 1][i] > 0:
				sum_ch += 1
		print('Yes' if sum_ch > 2 else 'No')


import string
from itertools import islice

def solve():
	s = input()
	n = int(input())
	alphabets = len(string.ascii_lowercase)
	count = [[0] * alphabets for _ in range(len(s) + 1)]
	for (i, c) in enumerate(s, 1):
		count[i][ord(c) - ord('a')] += 1
		for c in range(alphabets):
			count[i][c] += count[i - 1][c]

	def query(l, r):
		if l == r:
			return 'Yes'
		if s[l - 1] != s[r - 1]:
			return 'Yes'
		unique = (True for (x, y) in zip(count[l - 1], count[r]) if y - x > 0)
		if len(list(islice(unique, 3))) == 3:
			return 'Yes'
		return 'No'
	for _ in range(n):
		print(query(*map(int, input().split())))
solve()


import sys
input = sys.stdin.readline
s = input().rstrip('\n')
l = len(s)
ref = [[0] * 26]
ref1 = [0] * 26
for i in range(l):
	ref1[ord(s[i]) - 97] += 1
	ref.append(ref1.copy())
q = int(input())
for i in range(q):
	(l, r) = map(int, input().split())
	if l == r or s[l - 1] != s[r - 1]:
		print('Yes')
		continue
	p = 0
	f = [ref[r][k] - ref[l - 1][k] for k in range(26)]
	for i in f:
		if i > 0:
			p += 1
	if p >= 3:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
S = list(input().rstrip())
Q = int(input())
Query = []
for _ in range(Q):
	(l, r) = map(int, input().split())
	Query.append((l - 1, r - 1))
Alp = [chr(i) for i in range(97, 97 + 26)]
dic = {}
for alp in Alp:
	dic[alp] = [0]
for (i, s) in enumerate(S):
	for alp in Alp:
		if s == alp:
			dic[alp].append(dic[alp][-1] + 1)
		else:
			dic[alp].append(dic[alp][-1])
for (l, r) in Query:
	P = []
	for alp in Alp:
		d = dic[alp][r + 1] - dic[alp][l]
		if d > 0:
			P.append(alp)
	if len(P) == 1:
		ok = True if l == r else False
	elif len(P) > 2:
		ok = True
	else:
		ok = True if S[l] != S[r] else False
	print('Yes' if ok else 'No')


import sys
input = sys.stdin.readline
s = [i for i in input() if i != '\n']
freq = [[0 for i in range(26)] for _ in range(len(s))]
for i in range(len(s)):
	freq[i][ord(s[i]) - 97] += 1
	if i > 0:
		for j in range(26):
			freq[i][j] += freq[i - 1][j]
q = int(input())
for i in range(q):
	(l, r) = map(int, input().split())
	count = 0
	for j in range(26):
		temp = freq[r - 1][j]
		if l > 1:
			temp -= freq[l - 2][j]
		if temp:
			count += 1
	if r == l or count >= 3 or s[l - 1] != s[r - 1]:
		print('Yes')
	else:
		print('No')


def first():
	s = input()
	cases = int(input())
	lastChange = [0] * len(s)
	lastChange[0] = 0
	lc = s[0]
	for i in range(1, len(s)):
		c = s[i]
		if c != lc:
			lastChange[i] = i
			lc = c
		else:
			lastChange[i] = lastChange[i - 1]
	for i in range(cases):
		(l, r) = map(int, input().split())
		l -= 1
		if r - l == 1:
			print('Yes')
			continue
		if s[l] != s[r - 1]:
			print('Yes')
			continue
		answer = 'No'
		p = lastChange[r - 1]
		c1 = s[r - 1]
		if p > l:
			c2 = s[p - 1]
		while p > l:
			print('-', p)
			if s[p - 1] != c1 and s[p - 1] != c2:
				answer = 'Yes'
				break
			p = lastChange[p - 1]
		print(answer)
s = input()
cases = int(input())
if len(s) > 1:
	char3 = []
	next3 = [None] * len(s)
	p1 = 0
	c1 = s[0]
	p2 = None
	for i in range(1, len(s)):
		if s[i] != c1:
			p2 = i
			c2 = s[i]
			break
	if p2 != None:
		for i in range(p2, len(s)):
			if s[i] == c1:
				p1 = i
			elif s[i] == c2:
				p2 = i
			else:
				if p1 > p2:
					(p1, c1, p2, c2) = (p2, c2, p1, c1)
				char3.append((p1, i))
				(p1, c1, p2, c2) = (p2, c2, i, s[i])
	if char3 != []:
		i = 0
		for j in range(len(s)):
			while i < len(char3) and j > char3[i][0]:
				i += 1
			if i < len(char3):
				next3[j] = i
for i in range(cases):
	(l, r) = map(int, input().split())
	l -= 1
	if r - l == 1:
		print('Yes')
		continue
	if s[l] != s[r - 1]:
		print('Yes')
		continue
	if next3[l] != None and char3[next3[l]][1] <= r - 1:
		print('Yes')
		continue
	print('No')


base = 97

def get(l, r):
	cnt = 0
	if l == 0:
		for i in range(26):
			if S[i][r] > 0:
				cnt += 1
	else:
		for i in range(26):
			if S[i][r] - S[i][l - 1] > 0:
				cnt += 1
	return cnt
s = input()
q = int(input())
ans = []
S = [[0] * len(s) for _ in range(26)]
for (i, c) in enumerate(s):
	pos = ord(c) - base
	S[pos][i] += 1
for _ in range(1, len(s)):
	for i in range(26):
		S[i][_] = S[i][_] + S[i][_ - 1]
for _ in range(q):
	(l, r) = map(int, input().split())
	l -= 1
	r -= 1
	if l == r:
		ans.append('Yes')
	elif s[r] != s[l]:
		ans.append('Yes')
	else:
		cnt = get(l, r)
		if cnt >= 3:
			ans.append('Yes')
		else:
			ans.append('No')
print('\n'.join(ans))


from operator import itemgetter
from collections import Counter
from sys import stdin
input = stdin.readline

def solve(s):
	alphs = 'abcdefghijklmnopqrstuvwxyz'
	cumsum_dict = {a: [0] for a in alphs}
	for (i, ss) in enumerate(s):
		for a in alphs:
			cumsum_dict[a].append(cumsum_dict[a][i])
		cumsum_dict[ss][i + 1] += 1
	q = int(input())
	for i in range(q):
		(l, r) = map(int, input().split())
		ls = s[l - 1]
		rs = s[r - 1]
		al_set = set([])
		for a in alphs:
			if cumsum_dict[a][r] - cumsum_dict[a][l - 1] > 0:
				al_set.add(a)
		al_num = len(al_set)
		if l == r or ls is not rs or al_num >= 3:
			print('Yes')
		else:
			print('No')

def main():
	s = input().rstrip()
	solve(s)
main()