#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
vector<long long> prime(1000001, 1);
vector<long long> fact(200001);
vector<long long> pri;
vector<long long> sdf(10000001, 1);
long long inf = 1000000000000000007;
void solve() {
  string s;
  cin >> s;
  int n, i, j;
  n = s.length();
  vector<int> x(n + 1, 0), y(n + 1, 0), z(n + 1, 0);
  for (i = 0; i < n; i++) {
    if (s[i] == 'x') x[i + 1]++;
    if (s[i] == 'y') y[i + 1]++;
    if (s[i] == 'z') z[i + 1]++;
  }
  for (i = 1; i <= n; i++) {
    x[i] += x[i - 1];
    y[i] += y[i - 1];
    z[i] += z[i - 1];
  }
  int q;
  cin >> q;
  for (i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    if (r - l + 1 <= 2) {
      cout << "YES" << endl;
      continue;
    }
    int xx = x[r] - x[l - 1];
    int yy = y[r] - y[l - 1];
    int zz = z[r] - z[l - 1];
    int mini = min(xx, yy);
    mini = min(mini, zz);
    int maxi = max(xx, yy);
    maxi = max(maxi, zz);
    xx -= mini;
    yy -= mini;
    zz -= mini;
    if (abs(maxi - mini) > 1) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  while (t) {
    t--;
    solve();
  }
}
