#include <bits/stdc++.h>
using namespace std;
int a[100000 + 10][3] = {{0}};
string s;
int main() {
  cin >> s;
  a[0][0] = 0;
  a[0][1] = 0;
  a[0][2] = 0;
  for (int i = 1; i <= s.size(); i++) {
    a[i][0] = a[i - 1][0];
    a[i][1] = a[i - 1][1];
    a[i][2] = a[i - 1][2];
    if (s[i - 1] == 'x') {
      a[i][0]++;
    }
    if (s[i - 1] == 'y') {
      a[i][1]++;
    }
    if (s[i - 1] == 'z') {
      a[i][2]++;
    }
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int r, l;
    cin >> r >> l;
    if (l - r + 1 < 3) {
      cout << "YES" << endl;
    } else {
      int y = l - r + 1;
      int rr[3];
      rr[0] = a[l][0] - a[r - 1][0];
      rr[1] = a[l][1] - a[r - 1][1];
      rr[2] = a[l][2] - a[r - 1][2];
      sort(rr, rr + 3);
      if (y % 3 == 0) {
        if (rr[0] == rr[1] && rr[0] == rr[2]) {
          cout << "YES" << endl;
        } else {
          cout << "NO" << endl;
        }
      }
      if (y % 3 == 1) {
        if (rr[0] == rr[1] && rr[1] + 1 == rr[2]) {
          cout << "YES" << endl;
        } else {
          cout << "NO" << endl;
        }
      }
      if (y % 3 == 2) {
        if (rr[0] + 1 == rr[1] && rr[1] == rr[2]) {
          cout << "YES" << endl;
        } else {
          cout << "NO" << endl;
        }
      }
    }
  }
}
