#include <bits/stdc++.h>
using namespace std;
template <typename T>
T pow(T a, T b, long long int m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
template <typename T>
void swap(T *a, T *b) {
  T temp = *a;
  *a = *b;
  *b = temp;
  return;
}
const long long int N = 1e5 + 2;
long long int x[N], y[N], z[N];
void solve() {
  long long int temp = N;
  for (__typeof(temp) i = (0) - ((0) > (temp)); i != (temp) - ((0) > (temp));
       i += 1 - 2 * ((0) > (temp))) {
    x[i] = 0;
    y[i] = 0;
    z[i] = 0;
  }
  string s;
  cin >> s;
  long long int len = s.length();
  for (__typeof(len) i = (0) - ((0) > (len)); i != (len) - ((0) > (len));
       i += 1 - 2 * ((0) > (len))) {
    if (s[i] == 'x')
      x[i + 1]++;
    else if (s[i] == 'y')
      y[i + 1]++;
    else
      z[i + 1]++;
  }
  long long int m;
  cin >> m;
  for (__typeof(len + 1) i = (1) - ((1) > (len + 1));
       i != (len + 1) - ((1) > (len + 1)); i += 1 - 2 * ((1) > (len + 1))) {
    x[i] += x[i - 1];
    y[i] += y[i - 1];
    z[i] += z[i - 1];
  }
  while (m--) {
    long long int l, r;
    cin >> l >> r;
    if (r - l + 1 <= 2) {
      cout << "YES" << '\n';
      continue;
    }
    long long int a = x[r] - x[l - 1];
    long long int b = y[r] - y[l - 1];
    long long int c = z[r] - z[l - 1];
    if (max({a, b, c}) - min({a, b, c}) <= 1) {
      cout << "YES\n";
    } else
      cout << "NO\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  solve();
  return 0;
}
