#include <bits/stdc++.h>
int N, M, c[100005][3];
char s[100005];
int main() {
  scanf("%s", s + 1), N = strlen(s + 1);
  for (int i = 1; i <= N; i++)
    for (int j = 0; j < 3; j++) c[i][j] = c[i - 1][j] + (s[i] == j + 120);
  scanf("%d", &M);
  for (int i = 1, l, r, x, y, z; i <= M; i++) {
    scanf("%d%d", &l, &r);
    if (r - l < 2) {
      puts("YES");
      continue;
    }
    x = c[r][0] - c[l - 1][0], y = c[r][1] - c[l - 1][1],
    z = c[r][2] - c[l - 1][2];
    puts(((x == y && x == z) || (x == y && z == x - 1) ||
          (x == y && z == x + 1) || (x == z && y == x - 1) ||
          (x == z && y == x + 1) || (y == z && x == y - 1) ||
          (y == z && x == y + 1))
             ? "YES"
             : "NO");
  }
}
