#include <bits/stdc++.h>
using namespace std;
int z[2000001], x[2000001], y[2000001];
int main() {
  string s;
  cin >> s;
  if (s[0] == 'x') x[0]++;
  if (s[0] == 'y') y[0]++;
  if (s[0] == 'z') z[0]++;
  for (int i = 1; i < s.length(); i++) {
    x[i] = x[i - 1], y[i] = y[i - 1], z[i] = z[i - 1];
    if (s[i] == 'x') x[i]++;
    if (s[i] == 'y') y[i]++;
    if (s[i] == 'z') z[i]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int X, Y, Z;
    int l, r;
    cin >> l >> r;
    l--, r--;
    if (r - l < 2) {
      cout << "YES" << endl;
      continue;
    }
    if (l == 0) {
      Z = z[r];
      X = x[r];
      Y = y[r];
    } else {
      Z = z[r] - z[l - 1];
      X = x[r] - x[l - 1];
      Y = y[r] - y[l - 1];
    }
    if (abs(X - Y) <= 1 && abs(X - Z) <= 1 && abs(Y - Z) <= 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
