#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const long long N = 100005;
long long cnt[N][3];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long n = s.length();
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 3; j++) {
      cnt[i + 1][j] = cnt[i][j];
      if ((s[i] - 'x') == j) cnt[i + 1][j]++;
    }
  }
  long long m, x, y;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    cin >> x >> y;
    long long mn = 1e9, mx = -1e9;
    for (long long j = 0; j < 3; j++) {
      mx = max(mx, cnt[y][j] - cnt[x - 1][j]);
      mn = min(mn, cnt[y][j] - cnt[x - 1][j]);
    }
    if (mx - mn < 2 || y - x <= 1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
