#include <bits/stdc++.h>
using namespace std;
int cnt[100009], a[100009][3];
int main() {
  string s;
  cin >> s;
  int n = s.length(), i, q, l, r;
  s = "0" + s + "00";
  for (i = 1; i <= n; 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] == 'x') a[i][0]++;
    if (s[i] == 'y') a[i][1]++;
    if (s[i] == 'z') a[i][2]++;
    cnt[i] = cnt[i - 1];
    if (s[i] == 'z' && s[i + 1] == 'y' && s[i + 2] == 'x')
      cnt[i]++;
    else if (s[i] == 'x' && s[i + 1] == 'z' && s[i + 2] == 'y')
      cnt[i]++;
    else if (s[i] == 'y' && s[i + 1] == 'x' && s[i + 2] == 'z')
      cnt[i]++;
  }
  cin >> q;
  while (q--) {
    cin >> l >> r;
    if (r - l + 1 < 3) {
      cout << "YES\n";
      continue;
    }
    if (cnt[r - 2] - cnt[l - 1] == r - l + 1 - 2) {
      cout << "YES\n";
      continue;
    }
    int x = a[r][0] - a[l - 1][0];
    int y = a[r][1] - a[l - 1][1];
    int z = a[r][2] - a[l - 1][2];
    int xx = abs(x - y);
    int yy = abs(y - z);
    int zz = abs(x - z);
    if (xx <= 1 && yy <= 1 && zz <= 1) {
      cout << "YES\n";
      continue;
    }
    cout << "NO\n";
  }
  return 0;
}
