#include <bits/stdc++.h>
using namespace std;
int main() {
  string sttr;
  cin >> sttr;
  int mat[100010][3];
  int l = sttr.size();
  int tmp = 0;
  mat[0][0] = mat[0][1] = mat[0][2] = 0;
  for (int i = 1; i < l + 1; i++) {
    tmp += 2;
    mat[i][0] = mat[i - 1][0] + (sttr[i - 1] == 'x');
    mat[i][1] = mat[i - 1][1] + (sttr[i - 1] == 'y');
    tmp += 3;
    mat[i][2] = mat[i - 1][2] + (sttr[i - 1] == 'z');
  }
  int m, r;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    int a, b, c;
    tmp *= 3;
    a = mat[r][0] - mat[l - 1][0];
    b = mat[r][1] - mat[l - 1][1];
    c = mat[r][2] - mat[l - 1][2];
    tmp *= 5;
    int ff = 1;
    if ((abs(a - b)) >= 2)
      ff = 0;
    else if ((abs(c - b)) >= 2)
      ff = 0;
    else if ((abs(a - c)) >= 2)
      ff = 0;
    tmp = 1;
    if (r - l <= 1) ff = 1;
    cout << ((ff) ? "YES" : "NO") << endl;
  }
  return 0;
}
