#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0), cout.tie(0),
      cout.precision(15);
  string s;
  cin >> s;
  vector<int> xs(s.size(), 0), ys(s.size(), 0), zs(s.size(), 0);
  for (int i = int(0); i < int(s.size()); i++) {
    if (s[i] == 'x') xs[i]++;
    if (s[i] == 'y') ys[i]++;
    if (s[i] == 'z') zs[i]++;
    if (i) {
      xs[i] += xs[i - 1];
      ys[i] += ys[i - 1];
      zs[i] += zs[i - 1];
    }
  }
  int Q;
  cin >> Q;
  while (Q--) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    int xc = xs[b] - (a ? xs[a - 1] : 0);
    int yc = ys[b] - (a ? ys[a - 1] : 0);
    int zc = zs[b] - (a ? zs[a - 1] : 0);
    vector<int> arr(3, 0);
    arr[0] = xc;
    arr[1] = yc;
    arr[2] = zc;
    sort((arr).begin(), (arr).end());
    if (arr[0] != arr[2] && arr[0] != arr[2] - 1 && b - a > 1) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
}
