#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
template <class T>
bool get_max(T& a, const T& b) {
  return b > a ? a = b, 1 : 0;
}
template <class T>
bool get_min(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
char s[110000];
int x[110000];
int y[110000];
int z[110000];
void init() {
  int leng = strlen(s);
  if (s[0] == 'x') {
    x[0] = 1;
  } else if (s[0] == 'y') {
    y[0] = 1;
  } else if (s[0] == 'z') {
    z[0] = 1;
  }
  for (int i = 1; i < leng; i++) {
    if (s[i] == 'x') {
      x[i] = x[i - 1] + 1;
      y[i] = y[i - 1];
      z[i] = z[i - 1];
    } else if (s[i] == 'y') {
      y[i] = y[i - 1] + 1;
      x[i] = x[i - 1];
      z[i] = z[i - 1];
    } else if (s[i] == 'z') {
      z[i] = z[i - 1] + 1;
      x[i] = x[i - 1];
      y[i] = y[i - 1];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(true);
  cin >> s;
  int m;
  cin >> m;
  init();
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES" << endl;
    } else {
      int a[3] = {0, 0, 0};
      if (l > 1) {
        a[0] = x[r - 1] - x[l - 2];
        a[1] = y[r - 1] - y[l - 2];
        a[2] = z[r - 1] - z[l - 2];
      } else {
        a[0] = x[r - 1];
        a[1] = y[r - 1];
        a[2] = z[r - 1];
      }
      sort(a, a + 3);
      if (a[0] && a[1] &&
          (a[1] == a[0] && a[2] == a[1] ||
           a[1] - a[0] == 0 && a[2] - a[1] == 1 ||
           a[1] - a[0] == 1 && a[2] - a[1] == 0)) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
  return 0;
}
