#include <bits/stdc++.h>
#define N 512202
using namespace std;

const int _1[13] = {19, 41, 43, 71, 97, 199, 293, 359, 661, 1201, 4493, 8111, 8527};
const int _2[17] = {1009, 1093, 1201, 1847, 2357, 2657, 2963, 4507,
4721, 5039, 5227, 5471, 5783, 5927, 6469, 7307, 8563};
const int z1[17] = {1949639529, 286828591, 506243666, 613426512, 565176353,
1732683515, 456216594, 856761466, 516876564, 321786342, 807132947,
321947198, 759807980, 679807890, 837504983, 216798076, 598097298};
const int z2[13] = {719032874, 1932598019, 804759801, 732947698,
690745973, 219476215, 964598032, 649803217, 498032170,
439807586, 587436980, 321754981, 759874319};

bool flag;
int n, i;
int Q, l, r;
int f[N][27];
int st[N], pt;
char s[N];
char hmap[0x1000000];

int getHcode(string &str){
	int i, len = str.length();
	int h1 = 0, h2 = 0;
	for(i = 0; i < len; i++){
		h1 = h1 * _1[i % 13] + z1[i % 17] + str[i];
		h2 = h2 * _2[i % 17] + z2[i % 13] + str[i];
		h1 ^= h2 << 1;
		h2 ^= h1 << 1;
	}
	h1 = h1 * _1[i % 13];
	h2 = h2 * _2[i % 17];
	h2 ^= (h1 ^ 0x29aee) << 1;
	h1 ^= (h2 ^ 0x29aee) << 1;
	return (h1 ^ h2) & 0xffffff;
}

int main(){
	scanf("%s%d", s, &Q);
	memset(hmap, 0, sizeof hmap);
	while(Q--){
		scanf("%d%d", &l, &r);
		--l;
		string t(s + l, s + r);
		pt = 0;
		for(n = r - l, flag = false; ; flag = false){
			st[pt] = getHcode(t);
//			cout << "n = " << n << ", Str = " << t << ", hash = " << st[pt] << '\n';		
			if(hmap[st[pt]]){
				puts(hmap[st[pt]] == 1 ? "NO" : "YES");
				break;
			}
			++pt;
			for(i = 0; i < n - 1; i++)
				if(t[i] == t[i + 1]){
					if(t[i] == 'z'){
						t.erase(i, 2);
						n -= 2;
					}else{
						++t[i];
						t.erase(i + 1, 1);
						--n;
					}
					flag = true;
					break;
				}
			if(!flag){
				puts(n ? "NO" : "YES");
				while(pt > 0) hmap[st[--pt]] = n ? 1 : 2;
				break;
			}
		}
	}
	return 0;
}
