#include <bits/stdc++.h>
using namespace std;
string s;
inline int t(int i, char c) { return s[i] == c ? 1 : 0; }
int main() {
  cin >> s;
  int n = s.size();
  vector<int> nx(n + 1), ny(n + 1), nz(n + 1);
  for (int i = 1; i < n + 1; ++i) {
    nx[i] = nx[i - 1] + t(i - 1, 'x');
    ny[i] = ny[i - 1] + t(i - 1, 'y');
    nz[i] = nz[i - 1] + t(i - 1, 'z');
  }
  int m;
  cin >> m;
  stringstream ss;
  while (m--) {
    int l, r;
    cin >> l >> r;
    int x = nx[r] - nx[l - 1];
    int y = ny[r] - ny[l - 1];
    int z = nz[r] - nz[l - 1];
    if ((r - l + 1 < 3) || (x >= 1 && y >= 1 && z >= 1 && abs(x - y) <= 1 &&
                            abs(x - z) <= 1 && abs(y - z) <= 1))
      ss << "YES\n";
    else
      ss << "NO\n";
  }
  cout << ss.str();
  return 0;
}
