#include <bits/stdc++.h>
using namespace std;
int main() {
  string ss;
  cin >> ss;
  int n;
  int len = ss.length();
  int x[len + 3], y[len + 3], z[len + 3];
  x[0] = 0;
  y[0] = 0;
  z[0] = 0;
  for (int i = 0; i < len; i++) {
    if (ss[i] == 'x') {
      x[i + 1] = x[i] + 1;
      y[i + 1] = y[i];
      z[i + 1] = z[i];
    } else if (ss[i] == 'y') {
      x[i + 1] = x[i];
      y[i + 1] = y[i] + 1;
      z[i + 1] = z[i];
    } else if (ss[i] == 'z') {
      x[i + 1] = x[i];
      y[i + 1] = y[i];
      z[i + 1] = z[i] + 1;
    }
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int l, r;
    scanf("%d", &l);
    scanf("%d", &r);
    int nx = x[r] - x[l - 1];
    int ny = y[r] - y[l - 1];
    int nz = z[r] - z[l - 1];
    if (r - l + 1 < 3) {
      puts("YES");
      continue;
    }
    if (max(max(nx, ny), nz) - min(min(nx, ny), nz) <= 1)
      puts("YES");
    else
      puts("NO");
  }
}
