#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
const int N = 100007;
char st[N];
int cnt[N][26];
int main() {
  scanf("%s", st + 1);
  int n = strlen(st + 1);
  for (int i = 1; i <= n; ++i) cnt[i][st[i] - 'a'] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 26; ++j) cnt[i][j] += cnt[i - 1][j];
  int m;
  scanf("%d", &m);
  while (m--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (r - l + 1 <= 2) {
      puts("YES");
      continue;
    }
    bool f = true;
    int x[3];
    x[0] = cnt[r][23] - cnt[l - 1][23];
    x[1] = cnt[r][24] - cnt[l - 1][24];
    x[2] = cnt[r][25] - cnt[l - 1][25];
    int len = r - l + 1;
    int y[3];
    y[0] = y[1] = y[2] = len / 3;
    for (int j = 0; j < len % 3; ++j) ++y[j];
    sort(x, x + 3);
    sort(y, y + 3);
    for (int i = 0; i < 3; ++i) {
      if (x[i] != y[i]) {
        f = false;
        break;
      }
    }
    puts(f ? "YES" : "NO");
  }
  return 0;
}
