#include <bits/stdc++.h>
template <typename _T>
using MaxHeap = std::priority_queue<_T>;
template <typename _T>
using MinHeap = std::priority_queue<_T, std::vector<_T>, std::greater<_T>>;
template <typename _T>
inline bool chmax(_T &_l, const _T _b) {
  if (_l < _b) {
    _l = _b;
    return true;
  }
  return false;
}
template <typename _T>
inline bool chmin(_T &_l, const _T _b) {
  if (_l > _b) {
    _l = _b;
    return true;
  }
  return false;
}
template <typename _T>
void vdeb(const std::vector<_T> &bb) {
  for (unsigned int i = 0; i < bb.size(); i++) {
    if (i == bb.size() - 1)
      std::cout << bb[i];
    else
      std::cout << bb[i] << ' ';
  }
  std::cout << '\n';
}
template <typename _T>
void vdeb(const std::vector<std::vector<_T>> &bb) {
  for (unsigned int i = 0; i < bb.size(); i++) {
    std::cout << i << ' ';
    vdeb(bb[i]);
  }
  std::cout << '\n';
}
using namespace std;
int main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  vector<vector<int>> da(s.size() + 1, vector<int>(3));
  for (int i = (0); i < (int)(s.size()); i++) {
    for (int j = (0); j < (int)(3); j++) {
      da[i + 1][j] = da[i][j];
    }
    da[i + 1][s[i] - 'x']++;
  }
  vector<bool> ans(q);
  for (int i = (0); i < (int)(q); i++) {
    int l, r;
    cin >> l >> r;
    if (r - l < 2) {
      ans[i] = true;
      continue;
    }
    int x = da[r][0] - da[l - 1][0];
    int y = da[r][1] - da[l - 1][1];
    int z = da[r][2] - da[l - 1][2];
    if (max({x, y, z}) - min({x, y, z}) <= 1) {
      ans[i] = true;
    } else {
      ans[i] = false;
    }
  }
  for (int i = (0); i < (int)(q); i++) {
    cout << ((ans[i]) ? "YES" : "NO") << endl;
  }
}
