#include <bits/stdc++.h>
using namespace std;
int num_x[100009];
int num_y[100009];
int num_z[100009];
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'x') {
      num_x[i + 1] = num_x[i] + 1;
      num_y[i + 1] = num_y[i];
      num_z[i + 1] = num_z[i];
    }
    if (s[i] == 'y') {
      num_x[i + 1] = num_x[i];
      num_y[i + 1] = num_y[i] + 1;
      num_z[i + 1] = num_z[i];
    }
    if (s[i] == 'z') {
      num_x[i + 1] = num_x[i];
      num_y[i + 1] = num_y[i];
      num_z[i + 1] = num_z[i] + 1;
    }
  }
  int m, l, r;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    int numx = num_x[r] - num_x[l - 1];
    int numy = num_y[r] - num_y[l - 1];
    int numz = num_z[r] - num_z[l - 1];
    if (r - l + 1 < 3)
      cout << "YES" << endl;
    else if (abs(numx - numy) <= 1 && abs(numy - numz) <= 1 &&
             abs(numz - numx) <= 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
