#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  vector<int> x(s.size()), y(s.size()), z(s.size());
  for (int i = 0; i < (int)s.size(); ++i) {
    if (i != 0)
      x[i] = x[i - 1], y[i] = y[i - 1], z[i] = z[i - 1];
    else
      x[i] = 0, y[i] = 0, z[i] = 0;
    if (s[i] == 'x') x[i]++;
    if (s[i] == 'y') y[i]++;
    if (s[i] == 'z') z[i]++;
  }
  int m;
  cin >> m;
  int l, r;
  int cx, cy, cz;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r;
    if (r - l + 1 < 3) {
      cout << "YES\n";
      continue;
    }
    l--, r--;
    cx = x[r];
    cy = y[r];
    cz = z[r];
    if (l > 0) cx -= x[l - 1], cy -= y[l - 1], cz -= z[l - 1];
    if ((abs(cx - cy) > 1) || (abs(cz - cy) > 1) || (abs(cx - cz) > 1))
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
