#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  vector<int> X(n), Y(n), Z(n);
  for (int i = 0; i < n; ++i) {
    X[i] = s[i] == 'x';
    Y[i] = s[i] == 'y';
    Z[i] = s[i] == 'z';
    if (i > 0) {
      X[i] += X[i - 1];
      Y[i] += Y[i - 1];
      Z[i] += Z[i - 1];
    }
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (b - a + 1 < 3) {
      cout << "YES\n";
      continue;
    }
    int x = X[b] - (a > 0 ? X[a - 1] : 0);
    int y = Y[b] - (a > 0 ? Y[a - 1] : 0);
    int z = Z[b] - (a > 0 ? Z[a - 1] : 0);
    if (abs(x - y) > 1 || abs(x - z) > 1 || abs(y - z) > 1)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
