#include <bits/stdc++.h>
using namespace std;
struct Triple {
  explicit Triple(int x_ = 0, int y_ = 0, int z_ = 0) : x(x_), y(y_), z(z_) {}
  int max() const { return ::max(x, ::max(y, z)); }
  int min() const { return ::min(x, ::min(y, z)); }
  int sum() const { return x + y + z; }
  Triple operator-(const Triple &other) const {
    return Triple(x - other.x, y - other.y, z - other.z);
  }
  int x, y, z;
};
ostream &operator<<(ostream &os, const Triple &t) {
  return (os << "(" << t.x << "; " << t.y << "; " << t.z << ")");
}
int main() {
  string s;
  s.reserve(5000);
  cin >> s;
  vector<Triple> a;
  a.reserve(s.size() + 1);
  a.push_back(Triple());
  int cx = 0, cy = 0, cz = 0;
  for (auto ch : s) {
    if (ch == 'x') {
      cx++;
    } else if (ch == 'y') {
      cy++;
    } else {
      cz++;
    }
    a.push_back(Triple(cx, cy, cz));
  }
  int M;
  cin >> M;
  for (int i = 0; i < M; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    Triple t = a[r] - a[l - 1];
    if (t.max() - t.min() <= 1 || t.sum() < 3) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
