#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 85 - 69;
int sum[maxn][3];
string s;
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  n = ((int)(s).size());
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) sum[i + 1][j] = sum[i][j] + (s[i] == ('x' + j));
  int q;
  cin >> q;
  while (q--) {
    int fi, se;
    cin >> fi >> se, fi--;
    if (se - fi <= 2) {
      cout << "YES\n";
      continue;
    }
    int val[3];
    for (int j = 0; j < 3; j++) val[j] = sum[se][j] - sum[fi][j];
    if (max(max(val[0], val[1]), val[2]) - min(min(val[0], val[1]), val[2]) <=
        1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
