#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
string s;
int cumx[(int)1e5 + 5], cumy[(int)1e5 + 5], cumz[(int)1e5 + 5], m, l, r;
bool can(int first, int second, int z) {
  if (abs(first - second) > 1 || (abs(first - z) > 1 || (abs(z - second) > 1)))
    return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  cin >> s >> m;
  for (int i = 0; i < s.size(); i++)
    cumx[i + 1] = cumx[i] + (s[i] == 'x'),
             cumy[i + 1] = cumy[i] + (s[i] == 'y'),
             cumz[i + 1] = cumz[i] + (s[i] == 'z');
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    if (r - l < 2)
      cout << "YES\n";
    else
      cout << (can(cumx[r] - cumx[l - 1], cumy[r] - cumy[l - 1],
                   cumz[r] - cumz[l - 1])
                   ? "YES\n"
                   : "NO\n");
  }
  return 0;
}
