#include <bits/stdc++.h>
using namespace std;
string s;
int x[100006], y[100006], z[100006];
int main() {
  cin >> s;
  int len = s.length();
  for (int i = 1; i <= len; i++) {
    x[i] = x[i - 1];
    y[i] = y[i - 1];
    z[i] = z[i - 1];
    if (s[i - 1] == 'x') x[i]++;
    if (s[i - 1] == 'y') y[i]++;
    if (s[i - 1] == 'z') z[i]++;
  }
  int t;
  cin >> t;
  int l, r;
  for (int i = 0; i < t; i++) {
    cin >> l >> r;
    if (r - l + 1 < 3) {
      printf("YES\n");
      continue;
    }
    int a = x[r] - x[l - 1];
    int b = y[r] - y[l - 1];
    int c = z[r] - z[l - 1];
    if (abs(a - b) > 1 || abs(a - c) > 1 || abs(b - c) > 1) {
      printf("NO\n");
    } else {
      printf("YES\n");
    }
  }
}
