#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const long long int inf = INT_MAX;
const long long int MOD = 1e9 + 7;
const long long int N = 1e5 + 5;
long long int c[N][3];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  for (long long int i = 0; i < s.length(); i++) {
    for (long long int j = 0; j < 3; j++) {
      if (s[i] - 'x' == j)
        c[i + 1][j] = c[i][j] + 1;
      else
        c[i + 1][j] = c[i][j];
    }
  }
  long long int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    a--;
    long long int cx = c[b][0] - c[a][0];
    long long int cy = c[b][1] - c[a][1];
    long long int cz = c[b][2] - c[a][2];
    if (max({cx, cy, cz}) - min({cx, cy, cz}) > 1 && b - a >= 3)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
