#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 10;
int C[MAX_N][3];
int main() {
  string S;
  cin >> S;
  int N = S.size();
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 3; ++j) {
      C[i + 1][j] = C[i][j] + (S[i] == 'x' + j);
    }
  }
  int M;
  cin >> M;
  for (int i = 0; i < M; ++i) {
    int L, R;
    cin >> L >> R;
    --L;
    int mx = -1, mn = N + 1;
    for (int j = 0; j < 3; ++j) {
      int c = C[R][j] - C[L][j];
      if (c < mn) mn = c;
      if (c > mx) mx = c;
    }
    cout << (R - L < 3 || mx <= mn + 1 ? "YES" : "NO") << "\n";
  }
  return 0;
}
