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 \ge 2$ and $2k$ non-empty strings $s_1, t_1, s_2, t_2, \dots, s_k, t_k$ that satisfy the following conditions:

  If we write the strings $s_1, s_2, \dots, s_k$ in order, the resulting string will be equal to $s$;  If we write the strings $t_1, t_2, \dots, t_k$ in order, the resulting string will be equal to $t$;  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 \le l \le r \le |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 \le |s| \le 2 \cdot 10^5$).

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

Each of the following $q$ lines contain two integers $l$ and $r$ ($1 \le l \le r \le |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: HARD


Solutions:
import os
import sys
from io import BytesIO, IOBase

def main():
	s = input().rstrip()
	n = len(s)
	dp = [[0 for _ in range(26)] for _ in range(n + 1)]
	for (i, v) in enumerate(s):
		dp[i + 1][ord(v) - 97] = 1
		for j in range(26):
			dp[i + 1][j] += dp[i][j]
	for _ in range(int(input())):
		(l, r) = map(int, input().split())
		if r - l + 1 == 1:
			print('Yes')
		elif s[l - 1] != s[r - 1]:
			print('Yes')
		else:
			z = 0
			for i in range(26):
				z += dp[r][i] > dp[l - 1][i]
			if z > 2:
				print('Yes')
			else:
				print('No')
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')
main()


import sys
readline = sys.stdin.readline
S = list([ord(x) - 97 for x in readline().strip()])
N = len(S)
table = [[0] * 26 for _ in range(N)]
for i in range(N):
	table[i][S[i]] = 1
for i in range(1, N):
	for j in range(26):
		table[i][j] += table[i - 1][j]
Q = int(readline())
Ans = [None] * Q
for qu in range(Q):
	(l, r) = list(map(int, readline().split()))
	l -= 1
	r -= 1
	if l == r or S[l] != S[r]:
		Ans[qu] = True
		continue
	K = [table[r][j] - table[l][j] for j in range(26)]
	if len([k for k in K if k]) <= 2:
		Ans[qu] = False
	else:
		Ans[qu] = True
print('\n'.join(['Yes' if s else 'No' for s in Ans]))


import sys
import math
input = sys.stdin.readline
from functools import cmp_to_key

def pi():
	return int(input())

def pl():
	return int(input(), 16)

def ti():
	return list(map(int, input().split()))

def ts():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
mod = 998244353
f = []

def fact(n, m):
	global f
	f = [1 for i in range(n + 1)]
	f[0] = 1
	for i in range(1, n + 1):
		f[i] = f[i - 1] * i % m

def fast_mod_exp(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b = b >> 1
	return res

def inverseMod(n, m):
	return fast_mod_exp(n, m - 2, m)

def ncr(n, r, m):
	if r == 0:
		return 1
	return f[n] * inverseMod(f[n - r], m) % m * inverseMod(f[r], m) % m

def main():
	B()

def B():
	s = ts()
	t = pi()
	c = [[0 for j in range(len(s))] for i in range(26)]
	for i in range(26):
		for j in range(len(s)):
			if ord(s[j]) - ord('a') == i:
				c[i][j] = c[i][j - 1] + 1 if j > 0 else 1
			else:
				c[i][j] = c[i][j - 1] if j > 0 else 0
	for i in range(t):
		[l, r] = ti()
		count = 0
		for j in range(26):
			count += 1 if c[j][r - 1] - c[j][l - 1] > 0 else 0
		if s[l - 1] != s[r - 1] or l == r:
			print('Yes')
		elif count >= 3:
			print('Yes')
		else:
			print('No')
main()


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter
from pprint import pprint

def main():
	s = input()
	n = len(s)
	q = int(input())
	cnt = [[0] * 26 for i in range(n + 1)]
	for i in range(1, n + 1):
		for j in range(26):
			cnt[i][j] = cnt[i - 1][j]
		cnt[i][ord(s[i - 1]) - ord('a')] += 1
	for i in range(q):
		(l, r) = map(int, input().split())
		l -= 1
		r -= 1
		ok = True
		if l == r:
			print('Yes')
			continue
		k = s[r] != s[l]
		for i in range(26):
			if cnt[r + 1][i] > cnt[l][i]:
				k += 1
		if k > 2:
			print('Yes')
		else:
			print('No')
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')
for _ in range(1):
	main()


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


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


def charToInt(c):
	return ord(c) - ord('a')

def main():
	s = input()
	n = len(s)
	arr = [charToInt(c) for c in s]
	p = makeArr(0, n, 26)
	for i in range(n):
		p[i][arr[i]] += 1
	for i in range(1, n):
		for j in range(26):
			p[i][j] += p[i - 1][j]

	def getCnts(char, l, r):
		if l == 0:
			return p[r][char]
		else:
			return p[r][char] - p[l - 1][char]
	allans = []
	q = int(input())
	for _ in range(q):
		(l, r) = readIntArr()
		l -= 1
		r -= 1
		charTypeCnt = 0
		for j in range(26):
			if getCnts(j, l, r) > 0:
				charTypeCnt += 1
		if l == r:
			allans.append('Yes')
		elif charTypeCnt == 1:
			allans.append('No')
		elif charTypeCnt == 2:
			if arr[l] == arr[r]:
				allans.append('No')
			else:
				allans.append('Yes')
		else:
			allans.append('Yes')
	multiLineArrayPrint(allans)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(*args):
	assert len(args) >= 2, 'makeArr args should be (default value, dimension 1, dimension 2,...'
	if len(args) == 2:
		return [args[0] for _ in range(args[1])]
	else:
		return [makeArr(args[0], *args[2:]) for _ in range(args[1])]

def queryInteractive(x, y):
	print('? {} {}'.format(x, y))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


import sys
input = sys.stdin.readline
from collections import Counter
S = input().strip()
count = [[0] * 26 for i in range(len(S) + 1)]
c = 1
for s in S:
	for k in range(26):
		count[c][k] = count[c - 1][k]
	count[c][ord(s) - 97] += 1
	c += 1
Q = int(input())
for tests in range(Q):
	(l, r) = map(int, input().split())
	if l == r:
		print('Yes')
		continue
	elif S[l - 1] != S[r - 1]:
		print('Yes')
		continue
	elif len(S) <= 4:
		print('No')
		continue
	X = [count[r][j] - count[l - 1][j] for j in range(26)]
	NZERO = 0
	for x in X:
		if x != 0:
			NZERO += 1
	if NZERO <= 2:
		print('No')
	else:
		print('Yes')


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


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 = [[0 for j in range(ALPHA)]]
for i in range(len(s)):
	cnt.append(list(cnt[i]))
	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')


import sys
input = lambda : sys.stdin.readline().rstrip()
S = input()
N = len(S)
X = [[0] * 26 for _ in range(N + 1)]
for i in range(N):
	for j in range(26):
		X[i + 1][j] = X[i][j]
	a = ord(S[i]) - 97
	X[i + 1][a] += 1
Q = int(input())
for _ in range(Q):
	(l, r) = map(int, input().split())
	if l == r:
		print('Yes')
		continue
	l -= 1
	A = [X[r][i] - X[l][i] for i in range(26)]
	if A.count(0) < 24:
		print('Yes')
	elif A.count(0) > 24:
		print('No')
	elif S[l] == S[r - 1]:
		print('No')
	else:
		print('Yes')


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


PI = 3.141592653589793
INF = float('inf')
MOD = 1000000007

def bin32(num):
	return '{0:032b}'.format(num)

def add(x, y):
	return (x + y) % MOD

def sub(x, y):
	return (x - y + MOD) % MOD

def mul(x, y):
	return x * y % MOD

def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)

def power(x, y):
	res = 1
	x %= MOD
	while y != 0:
		if y & 1:
			res = mul(res, x)
		y >>= 1
		x = mul(x, x)
	return res

def mod_inv(n):
	return power(n, MOD - 2)

def prob(p, q):
	return mul(p, power(q, MOD - 2))

def ii():
	return int(input())

def li():
	return [int(i) for i in input().split()]

def ls():
	return [i for i in input().split()]
s = input()
n = len(s)
f = []
tmp = [0 for i in range(26)]
tmp[ord(s[0]) - 97] += 1
f.append(tmp)
for i in range(1, n):
	tmp = f[-1][:]
	tmp[ord(s[i]) - 97] += 1
	f.append(tmp)
q = ii()
for _ in range(q):
	(l, r) = li()
	l -= 1
	r -= 1
	if r == l:
		print('Yes')
		continue
	if s[l] != s[r]:
		print('Yes')
		continue
	cnt = 0
	for i in range(26):
		if l != 0:
			x = f[r][i] - f[l - 1][i]
			if x > 0:
				cnt += 1
		else:
			x = f[r][i]
			if x > 0:
				cnt += 1
	if cnt > 2:
		print('Yes')
		continue
	print('No')


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 math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
import sys
S = input()
mark = {}
pre = defaultdict(list)
temp = [0] * 26
pre[0] = temp.copy()
for i in range(len(S)):
	temp[ord(S[i]) - ord('a')] += 1
	pre[i + 1] = temp.copy()
for _ in range(int(input())):
	(l, r) = ilele()
	if l == r or S[l - 1] != S[r - 1]:
		print('YES')
	else:
		count = 0
		for (i, j) in zip(pre[l - 1], pre[r]):
			if j - i != 0:
				count += 1
		if count >= 3:
			print('YES')
		else:
			print('NO')


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


def main():
	s = input()
	n = len(s)
	cnt = [[0] * 26 for _ in range(n + 1)]
	for (i, c) in enumerate(s):
		cnt[i + 1][ord(c) - 97] = 1
	cnti = cnt[0]
	for i in range(n):
		cnti1 = cnt[i + 1]
		for j in range(26):
			cnti1[j] += cnti[j]
		cnti = cnti1
	t = int(input())
	for _ in range(t):
		(l, r) = map(int, input().split())
		k = 0
		cntr = cnt[r]
		cntl = cnt[l - 1]
		for j in range(26):
			if cntr[j] - cntl[j] > 0:
				k += 1
		if r - l == 0 or k > 2:
			ans = 'Yes'
		elif k == 2 and s[l - 1] != s[r - 1]:
			ans = 'Yes'
		else:
			ans = 'No'
		print(ans)
main()


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


s = input()
n = len(s)
num = [[0] * 26 for i in range(n)]
for i in range(n):
	p = ord(s[i]) - ord('a')
	if i != 0:
		for j in range(26):
			num[i][j] = num[i - 1][j]
	num[i][p] += 1

def solve(l: int, r: int) -> bool:
	if l == r:
		return True
	elif s[l] != s[r]:
		return True
	else:
		cnt = 0
		for i in range(26):
			if l > 0:
				if num[r][i] - num[l - 1][i] > 0:
					cnt += 1
			elif num[r][i] > 0:
				cnt += 1
		return True if cnt > 2 else False
q = int(input())
while q > 0:
	(l, r) = map(int, input().split())
	print('Yes') if solve(l - 1, r - 1) else print('No')
	q -= 1


import os
import sys
from io import BytesIO, IOBase
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')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	s = input()
	n = N()
	sm = [[0] * 26]
	a = ord('a')
	for i in s:
		sd = ord(i) - a
		now = sm[-1].copy()
		now[sd] += 1
		sm.append(now)
	for _ in range(n):
		(l, r) = RL()
		if l == r:
			print('Yes')
		else:
			tn = 0
			for i in range(26):
				now = sm[r][i] - sm[l - 1][i]
				if now != 0:
					tn += 1
			if s[l - 1] != s[r - 1] or tn >= 3:
				print('Yes')
			else:
				print('No')
main()


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 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
readline = sys.stdin.buffer.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	s = list(map(lambda x: x - 97, list(ns())))
	n = len(s)
	q = ni()
	f = [[0] * 26 for _ in range(n + 1)]
	for i in range(n):
		f[i + 1] = f[i][:]
		f[i + 1][s[i]] += 1
	for _ in range(q):
		(l, r) = nm()
		m = 0
		c = 0
		for i in range(26):
			x = f[r][i] - f[l - 1][i]
			if x:
				c += 1
			m = max(m, x)
		if r == l or c > 2 or (c == 2 and s[l - 1] != s[r - 1]):
			print('Yes')
		else:
			print('No')
	return
solve()


from collections import defaultdict
s = input().strip()
d = defaultdict(int)
vs = [[0] * 26 for _ in range(len(s) + 1)]
S = 'abcdefghijklmnopqrstuvwxyz'
dd = dict()
for i in range(26):
	dd[S[i]] = i
for (i, c) in enumerate(s):
	vs[i + 1] = vs[i][:]
	vs[i + 1][dd[c]] += 1
N = int(input())
for _ in range(N):
	(L, R) = map(int, input().split())
	if R == L:
		print('Yes')
	elif s[L - 1] != s[R - 1]:
		print('Yes')
	else:
		r = 0
		for i in range(26):
			c = vs[R][i] - vs[L - 1][i]
			if c > 0:
				r += 1
		if r < 3:
			print('No')
		else:
			print('Yes')


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


import sys
input = sys.stdin.readline
s = input().rstrip()
alphabet_cumcnt = [[0] * (len(s) + 1) for _ in range(26)]
orda = ord('a')
for (i, ch) in enumerate(s):
	for j in range(26):
		alphabet_cumcnt[j][i + 1] = alphabet_cumcnt[j][i]
	alphabet_cumcnt[ord(ch) - orda][i + 1] += 1
q = int(input())
for _ in range(q):
	(l, r) = map(int, input().split())
	ok = False
	ordl = ord(s[l - 1]) - orda
	ordr = ord(s[r - 1]) - orda
	num_l = alphabet_cumcnt[ordl][r] - alphabet_cumcnt[ordl][l - 1]
	num_r = alphabet_cumcnt[ordr][r] - alphabet_cumcnt[ordr][l - 1]
	num = r - l + 1
	if l == r:
		print('Yes')
		continue
	if ordl == ordr:
		kind = 0
		for i in range(26):
			nk = alphabet_cumcnt[i][r] - alphabet_cumcnt[i][l - 1]
			if nk > 0:
				kind += 1
		if kind >= 3:
			print('Yes')
		else:
			print('No')
		continue
	print('Yes')


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


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


import sys
input = sys.stdin.readline
s = input()
q = int(input())
query = [tuple(map(int, input().split())) for i in range(q)]
char = [[0] * 26 for i in range(len(s) + 1)]
for i in range(len(s)):
	si = ord(s[i]) - 97
	for j in range(26):
		if j == si:
			char[i + 1][j] = char[i][j] + 1
		else:
			char[i + 1][j] = char[i][j]
for (l, r) in query:
	count = 0
	for i in range(26):
		if char[r][i] - char[l - 1][i] != 0:
			count += 1
	if count == 1:
		if r == l:
			print('Yes')
		else:
			print('No')
	elif count == 2:
		if s[r - 1] == s[l - 1]:
			print('No')
		else:
			print('Yes')
	else:
		print('Yes')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
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')
mod = 10 ** 9 + 7
a = list(input())
n = len(a)
pre = [[0 for j in range(n + 1)] for i in range(26)]
for i in range(n):
	ch = ord(a[i]) - 97
	for j in range(26):
		pre[j][i + 1] = pre[j][i]
	pre[ch][i + 1] += 1
for i in range(int(input())):
	(l, r) = map(int, input().split())
	c = 0
	for j in range(26):
		if pre[j][r] != pre[j][l - 1]:
			c += 1
	if l == r or a[l - 1] != a[r - 1] or c >= 3:
		print('Yes')
	else:
		print('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')


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 = input()
sum = [[0 for i in range(26)] for i in range(len(s))]
sum[0][ord(s[0]) - ord('a')] = 1
for i in range(1, len(s)):
	for j in range(26):
		if ord(s[i]) - ord('a') == j:
			sum[i][j] = sum[i - 1][j] + 1
		else:
			sum[i][j] = sum[i - 1][j]
T = int(input())
for cas in range(T):
	(x, y) = map(int, input().split())
	x = x - 1
	y = y - 1
	num = 0
	for i in range(26):
		if x == 0:
			if sum[y][i] > 0:
				num = num + 1
		elif sum[y][i] - sum[x - 1][i] > 0:
			num = num + 1
	if x == y or s[x] != s[y] or num > 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()
lower = [[-1] * 26 for _ in range(len(s))]
get_code = lambda c: ord(c) - ord('a')
for i in range(len(s)):
	cd = get_code(s[i])
	for j in range(i, -1, -1):
		if lower[j][cd] != -1:
			break
		lower[j][cd] = i
for _ in range(int(input())):
	(l, r) = map(int, input().split())
	if r - l < 1:
		print('Yes')
		continue
	l -= 1
	r -= 1
	cnt = 0
	for i in range(26):
		if l <= lower[l][i] <= r:
			cnt += 1
	if cnt == 1:
		print('No')
	elif cnt == 2:
		if s[l] != s[r]:
			print('Yes')
		else:
			print('No')
	else:
		print('Yes')


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
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 = [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 diff(a, b):
	ans = []
	for i in range(len(a)):
		ans.append(a[i] - b[i])
	return ans
a = input()
n = len(a)
q = int(input())
count = [[0 for i in range(26)] for j in range(n)]
count[0][ord(a[0]) - 97] += 1
for i in range(1, n):
	for j in range(26):
		count[i][j] = count[i - 1][j]
	count[i][ord(a[i]) - 97] += 1
for i in range(q):
	(l, r) = map(int, input().split())
	if l == r:
		print('Yes')
	elif a[l - 1] != a[r - 1]:
		print('Yes')
	else:
		d = diff(count[r - 1], count[l - 1])
		if d.count(0) <= 23:
			print('Yes')
		else:
			print('No')


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


import bisect
s = input()
N = len(s)
alp = 'abcdefghijklmnopqrstuvwxyz'
dic = {}
for (i, al) in enumerate(alp):
	dic[al] = i
lis = [[0] * 26 for i in range(N + 1)]
change = []
for i in range(N):
	if i == 0 or s[i] != s[i - 1]:
		change.append(i + 1)
for i in range(N):
	i += 1
	for j in range(26):
		lis[i][j] = lis[i - 1][j]
	lis[i][dic[s[i - 1]]] += 1
nq = int(input())
for loop in range(nq):
	new = [0] * 26
	(l, r) = map(int, input().split())
	nz = 0
	maxi = 0
	for i in range(26):
		new[i] = lis[r][i] - lis[l - 1][i]
		if new[i] != 0:
			nz += 1
		maxi = max(maxi, new[i])
	if nz > 2:
		print('Yes')
	elif nz == 1:
		if maxi == 1:
			print('Yes')
		else:
			print('No')
	elif s[l - 1] == s[r - 1]:
		print('No')
	else:
		print('Yes')


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


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input()))
s = S()[:-1]
n = len(s)
dp = [[0 for i in range(n)] for j in range(26)]
dp1 = [0 for i in range(n + 1)]
for i in range(26):
	count = 0
	for j in range(len(s)):
		if ord(s[j]) - 97 == i:
			count += 1
			dp[i][j] = count
		else:
			dp[i][j] = count
(q,) = I()
for t1 in range(q):
	(l, r) = I()
	if abs(l - r) >= 1:
		if s[l - 1] != s[r - 1]:
			print('Yes')
		else:
			count = 0
			for k in range(len(dp)):
				if dp[k][l - 1] != dp[k][r - 1]:
					count += 1
			if count >= 3:
				print('Yes')
			else:
				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)


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


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


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


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


s = input()
h = []
for i in range(len(s)):
	h.append([-1] * 26)
i = len(s) - 2
h[-1][ord(s[-1]) - 97] = len(s) - 1
while i >= 0:
	for j in range(26):
		h[i][j] = h[i + 1][j]
	h[i][ord(s[i]) - 97] = i
	i -= 1
q = int(input())
for i in range(q):
	(x, y) = map(int, input().split())
	x -= 1
	y -= 1
	if y - x == 0:
		print('Yes')
	elif s[x] != s[y]:
		print('Yes')
	else:
		c = 0
		for j in range(26):
			if -1 < h[x][j] <= y:
				c += 1
		if c > 2:
			print('Yes')
		else:
			print('No')


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


import os
import sys
from io import BytesIO, IOBase
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')
dict1 = {}
for s in range(26):
	dict1[s] = 0
vals = [ord(k) - 97 for k in input()]
n = len(vals)
store = []
for s in range(n):
	dict1[vals[s]] += 1
	store.append(dict1.copy())
for j in range(int(input())):
	(l, r) = map(int, input().split())
	l -= 1
	r -= 1
	distinct = []
	if l == 0:
		dict2 = store[r]
	else:
		dict2 = store[r].copy()
		for s in range(26):
			dict2[s] -= store[l - 1][s]
	for s in range(26):
		if dict2[s] >= 1:
			distinct.append(dict2[s])
	if len(distinct) >= 3:
		print('Yes')
	elif len(distinct) == 2:
		if vals[l] == vals[r]:
			print('No')
		else:
			print('Yes')
	elif l == r:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
from heapq import heapify, heappush, heappop, heappushpop
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\r\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
s = '#' + S()
v = [[0] for i in range(26)]
for i in range(1, len(s)):
	for j in range(26):
		v[j] += (v[j][-1],)
	v[ord(s[i]) - 97][-1] += 1
for i in range(I()):
	(l, r) = R()
	dif = 0
	for i in range(26):
		if v[i][r] - v[i][l - 1]:
			dif += 1
	if not r - l or s[r] != s[l] or dif >= 3:
		print('YES')
	else:
		print('NO')