#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll X = 2e6;
const ll inf = 1e9 + 7ll;
ll dp[X][3];
void pre(string s) {
  ll n = s.size();
  for (ll i = 0; i < n; ++i) dp[i + 1][s[i] - 'x']++;
  for (ll i = 2; i < n + 1; ++i)
    for (ll j = 0; j < 3; ++j) dp[i][j] += dp[i - 1][j];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  ll n = s.size();
  pre(s);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll T;
  cin >> T;
  while (T--) {
    ll l, r;
    cin >> l >> r;
    if (r - l <= 1) {
      cout << "YES\n";
      continue;
    }
    ll mn = min({dp[r][2] - dp[l - 1][2], dp[r][1] - dp[l - 1][1],
                 dp[r][0] - dp[l - 1][0]});
    ll mx = max({dp[r][2] - dp[l - 1][2], dp[r][1] - dp[l - 1][1],
                 dp[r][0] - dp[l - 1][0]});
    cout << ((abs(mx - mn) <= 1) ? "YES\n" : "NO\n");
  }
}
