#include <bits/stdc++.h>
using namespace std;
const int size = 111111;
int n, m, t, k;
char ch[size];
int ci[3][size];
int change(int i) { return ch[i] - 'x'; }
int main() {
  cin >> ch;
  n = strlen(ch);
  for (int i = 0; i < n; i++) {
    int p = change(i);
    for (int j = 0; j < 3; j++) ci[j][i + 1] = ci[j][i];
    ci[p][i + 1]++;
  }
  cin >> m;
  int l, r;
  while (m--) {
    cin >> l >> r;
    if (r - l < 2)
      cout << "YES\n";
    else {
      int a[3];
      for (int i = 0; i < 3; i++) a[i] = ci[i][r] - ci[i][l - 1];
      sort(a, a + 3);
      int ov = 1;
      for (int i = 0; i < 3; i++)
        if (a[i] - a[0] > 1) ov = 0;
      if (ov)
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}
