#include <bits/stdc++.h>
using namespace std;
int x[100010];
int y[100010];
int z[100010];
int main() {
#pragma warning(disable : 4996)
  string s;
  cin >> s;
  int n = s.size();
  x[0] = 0;
  y[0] = 0;
  z[0] = 0;
  for (int i = 1; i < n + 1; 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 m;
  cin >> m;
  int a, b, c;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    a = x[r] - x[l - 1];
    b = y[r] - y[l - 1];
    c = z[r] - z[l - 1];
    if (r - l < 2)
      cout << "YES" << endl;
    else {
      if (abs(a - b) < 2 && abs(a - c) < 2 && abs(b - c) < 2)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
