#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int n;
  cin >> n;
  pair<pair<int, int>, int> ar[s.size()];
  int x = 0, y = 0, z = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'x') {
      x++;
    } else if (s[i] == 'y') {
      y++;
    } else {
      z++;
    }
    ar[i].first.first = x;
    ar[i].first.second = y;
    ar[i].second = z;
  }
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    if (r - l <= 1) {
      cout << "YES" << endl;
      continue;
    }
    l--;
    r--;
    int a, b, c;
    if (l == 0) {
      a = ar[r].first.first;
      b = ar[r].first.second;
      c = ar[r].second;
    } else {
      l--;
      a = ar[r].first.first - ar[l].first.first;
      b = ar[r].first.second - ar[l].first.second;
      c = ar[r].second - ar[l].second;
    }
    if ((a == b && b == c) || (a == b && c == a + 1) ||
        (a == c && b == a + 1) || (b == c && a == b + 1) ||
        (a == b && c == a - 1) || (a == c && b == a - 1) ||
        (b == c && a == b - 1)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
