#include <bits/stdc++.h>
using namespace std;
string str;
int sum[100024][3];
void precompute() {
  memset(sum, 0, sizeof(sum));
  if (str[0] == 'x')
    sum[0][0]++;
  else if (str[0] == 'y')
    sum[0][1]++;
  else
    sum[0][2]++;
  for (int i = 1; i < str.size(); i++) {
    if (str[i] == 'x') {
      sum[i][0] = sum[i - 1][0] + 1;
      sum[i][1] = sum[i - 1][1];
      sum[i][2] = sum[i - 1][2];
    } else if (str[i] == 'y') {
      sum[i][0] = sum[i - 1][0];
      sum[i][1] = sum[i - 1][1] + 1;
      sum[i][2] = sum[i - 1][2];
    } else {
      sum[i][0] = sum[i - 1][0];
      sum[i][1] = sum[i - 1][1];
      sum[i][2] = sum[i - 1][2] + 1;
    }
  }
}
bool solve(int l, int r) {
  l--, r--;
  int a[3];
  for (int i = 0; i < 3; i++) a[i] = sum[r][i] - sum[l][i];
  if (str[l] == 'x')
    a[0]++;
  else if (str[l] == 'y')
    a[1]++;
  else
    a[2]++;
  if (r - l + 1 < 3) return true;
  int rem = (r - l + 1) % 3;
  sort(a, a + 3);
  switch (rem) {
    case 0:
      if (a[0] == a[1] && a[1] == a[2]) return true;
      break;
    case 1:
      if (a[0] == a[1] && a[2] - a[1] == 1) return true;
      break;
    case 2:
      if (a[1] == a[2] && a[1] - a[0] == 1) return true;
      break;
  }
  return false;
}
int main() {
  int m, l, r;
  cin >> str;
  scanf("%d", &m);
  precompute();
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &l, &r);
    if (solve(l, r))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
