#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int x[maxn];
int y[maxn];
int z[maxn];
char s[maxn];
void Init() {
  for (int i = 0; s[i] != '\0'; i++) {
    x[i + 1] = x[i];
    y[i + 1] = y[i];
    z[i + 1] = z[i];
    if (s[i] == 'x') {
      x[i + 1]++;
    } else if (s[i] == 'y') {
      y[i + 1]++;
    } else {
      z[i + 1]++;
    }
  }
}
void Solve() {
  int n, l, r;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    if (r - l + 1 < 3) {
      cout << "YES" << endl;
    } else {
      int num[3];
      num[0] = x[r] - x[l - 1];
      num[1] = y[r] - y[l - 1];
      num[2] = z[r] - z[l - 1];
      sort(num, num + 3);
      if (num[2] - num[0] < 2) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
}
int main() {
  cin >> s;
  Init();
  Solve();
  return 0;
}
