#include <bits/stdc++.h>
using namespace std;
set<pair<long long int, long long int> > st;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string str;
  cin >> str;
  long long int v[3][str.length() + 1];
  memset(v, 0, sizeof(v));
  for (long long int i = 1; i <= str.length(); i++) {
    v[0][i] += v[0][i - 1];
    v[1][i] += v[1][i - 1];
    v[2][i] += v[2][i - 1];
    if (str[i - 1] == 'x') v[0][i]++;
    if (str[i - 1] == 'y') v[1][i]++;
    if (str[i - 1] == 'z') v[2][i]++;
  }
  long long int m;
  cin >> m;
  while (m--) {
    long long int a, b;
    cin >> a >> b;
    vector<long long int> vv = {0, 0, 0};
    vv[0] = v[0][b] - v[0][a - 1];
    vv[1] = v[1][b] - v[1][a - 1];
    vv[2] = v[2][b] - v[2][a - 1];
    sort(vv.begin(), vv.end());
    if (vv[2] - vv[0] <= 1 || (b - a + 1) < 3)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  return 0;
}
