#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000000 + 7;
const int INF = 2000000000;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> x(n), y(n), z(n);
  if (s[0] == 'x')
    x[0] = 1;
  else if (s[0] == 'y')
    y[0] = 1;
  else if (s[0] == 'z')
    z[0] = 1;
  for (int i = 1; i < n; i++) {
    x[i] = x[i - 1];
    y[i] = y[i - 1];
    z[i] = z[i - 1];
    if (s[i] == 'x')
      x[i]++;
    else if (s[i] == 'y')
      y[i]++;
    else if (s[i] == 'z')
      z[i]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    int xc, yc, zc;
    xc = x[r - 1] - (l > 1 ? x[l - 2] : 0);
    yc = y[r - 1] - (l > 1 ? y[l - 2] : 0);
    zc = z[r - 1] - (l > 1 ? z[l - 2] : 0);
    int len = r - l + 1;
    if ((xc * 3 + 2 < len || yc * 3 + 2 < len || zc * 3 + 2 < len ||
         abs(xc - yc) > 1 || abs(zc - yc) > 1 || abs(xc - zc) > 1) &&
        len > 2)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
