#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int m = 0;
  cin >> m;
  vector<int> am[3];
  am[0].resize(s.size() + 1);
  am[1].resize(s.size() + 1);
  am[2].resize(s.size() + 1);
  for (int i = 1; i <= s.size(); i++) {
    am[0][i] = am[0][i - 1] + (s[i - 1] == 'x');
    am[1][i] = am[1][i - 1] + (s[i - 1] == 'y');
    am[2][i] = am[2][i - 1] + (s[i - 1] == 'z');
  }
  while (m--) {
    int l = 0, r = 0;
    cin >> l >> r;
    int x = am[0][r] - am[0][l - 1], y = am[1][r] - am[1][l - 1],
        z = am[2][r] - am[2][l - 1];
    if (r - l + 1 < 3)
      cout << "YES\n";
    else {
      if (max(x, max(y, z)) > min(x, min(y, z)) + 1)
        cout << "NO\n";
      else
        cout << "YES\n";
    }
  }
  return 0;
}
