#include <bits/stdc++.h>
using namespace std;
char s[100010];
int n, m, tx[100010], ty[100010], tz[100010];
bool check(int x, int y, int z) {
  if (z == y && y == x) return true;
  if (z == y + 1 && z == x + 1) return true;
  if (z == y && z == x + 1) return true;
  if (y == x + 1 && y == z + 1) return true;
  if (y == x && y == z + 1) return true;
  if (x == z + 1 && x == y + 1) return true;
  if (x == z && x == y + 1) return true;
  return false;
}
void solve() {
  for (int i = 1; i <= n; i++) {
    tx[i] = tx[i - 1];
    ty[i] = ty[i - 1];
    tz[i] = tz[i - 1];
    if (s[i] == 'x')
      tx[i]++;
    else if (s[i] == 'y')
      ty[i]++;
    else
      tz[i]++;
  }
  for (int i = 1; i <= m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    int cx = tx[r] - tx[l - 1], cy = ty[r] - ty[l - 1], cz = tz[r] - tz[l - 1];
    if (check(cx, cy, cz) || r - l <= 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  scanf("%d", &m);
  solve();
  return 0;
}
