#include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  n = s.length();
  cin >> k;
  vector<int> x(n, 0), y(n, 0), z(n, 0);
  x[0] = (s[0] == 'x' ? 1 : 0);
  y[0] = (s[0] == 'y' ? 1 : 0);
  z[0] = (s[0] == 'z' ? 1 : 0);
  for (int i = 1; i < n; i++) {
    x[i] = x[i - 1] + (s[i] == 'x' ? 1 : 0);
    y[i] = y[i - 1] + (s[i] == 'y' ? 1 : 0);
    z[i] = z[i - 1] + (s[i] == 'z' ? 1 : 0);
  }
  while (k--) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    int xs = x[r] - x[l];
    if (s[l] == 'x') xs++;
    int ys = y[r] - y[l];
    if (s[l] == 'y') ys++;
    int zs = z[r] - z[l];
    if (s[l] == 'z') zs++;
    if (r - l + 1 < 3)
      cout << "YES" << '\n';
    else {
      int mini = min(xs, min(ys, zs));
      xs -= mini;
      ys -= mini;
      zs -= mini;
      if (xs > 1 || zs > 1 || ys > 1)
        cout << "NO" << '\n';
      else if ((r - l + 1) % 3 == 0) {
        if (xs != 0 || ys != 0 || zs != 0)
          cout << "NO" << '\n';
        else
          cout << "YES" << '\n';
      } else {
        int left = (r - l + 1) % 3;
        int tot = xs + ys + zs;
        if (left == tot)
          cout << "YES" << '\n';
        else
          cout << "NO" << '\n';
      }
    }
  }
}
