#include <bits/stdc++.h>
using namespace std;
int a[3][500005];
int b[3];
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    for (int j = 0; j < 3; j++) {
      if (j == (s[i] - 'x')) {
        a[j][i + 1] = a[j][i] + 1;
      } else
        a[j][i + 1] = a[j][i];
    }
  }
  int m;
  cin >> m;
  int l, r;
  while (m--) {
    cin >> l >> r;
    if (r - l + 1 < 3) {
      cout << "YES" << endl;
      continue;
    }
    int fl = 0;
    for (int i = 0; i < 3; i++) {
      b[i] = a[i][r] - a[i][l - 1];
      if (b[i] == 0) {
        fl = 1;
        break;
      }
    }
    if (fl) {
      cout << "NO" << endl;
      continue;
    }
    sort(b, b + 3);
    for (int i = 1; i < 3; i++) {
      b[i] -= b[0];
    }
    b[0] = 0;
    if (b[1] + b[2] == 0) {
      cout << "YES" << endl;
      continue;
    }
    if (b[1] + b[2] >= 3) {
      cout << "NO" << endl;
    } else if (b[1] + b[2] == 1) {
      cout << "YES" << endl;
    } else if (b[1] == 0 || b[2] == 0) {
      cout << "NO" << endl;
    } else
      cout << "YES" << endl;
  }
  return 0;
}
