#include <bits/stdc++.h>
using namespace std;
template <typename T>
void SOUT(T what) {
  cout << what << endl;
}
stringstream out;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int h[3][n + 1];
  memset((h), (0), sizeof h);
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (3); ++j) h[j][i + 1] = h[j][i];
    h[s[i] - 'x'][i + 1]++;
  }
  int m;
  cin >> m;
  int a, b;
  for (int i = 0; i < (m); ++i) {
    cin >> a >> b;
    --a;
    --b;
    int x[3];
    memset((x), (0), sizeof x);
    for (int j = 0; j < (3); ++j) x[j] = h[j][b + 1] - h[j][a];
    int mi = min(x[0], min(x[1], x[2]));
    int res = 0;
    for (int j = 0; j < (3); ++j) {
      x[j] -= mi;
      res += x[j];
    }
    bool ok = false;
    if (res <= 1 || res == 2 && (x[0] != 2 && x[1] != 2 && x[2] != 2))
      ok = true;
    if (b - a <= 1) ok = true;
    out << (ok ? "YES" : "NO") << endl;
  }
  cout << out.str();
}
