#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int arr[100010][3];
  int l = str.size();
  arr[0][0] = arr[0][1] = arr[0][2] = 0;
  for (int i = 1; i <= l; i++) {
    arr[i][0] = arr[i - 1][0] + (str[i - 1] == 'x');
    arr[i][1] = arr[i - 1][1] + (str[i - 1] == 'y');
    arr[i][2] = arr[i - 1][2] + (str[i - 1] == 'z');
  }
  int m, r;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    int a, b, c;
    a = arr[r][0] - arr[l - 1][0];
    b = arr[r][1] - arr[l - 1][1];
    c = arr[r][2] - arr[l - 1][2];
    bool flag = 1;
    if ((abs(a - b)) >= 2)
      flag = 0;
    else if ((abs(c - b)) >= 2)
      flag = 0;
    else if ((abs(a - c)) >= 2)
      flag = 0;
    if (r - l <= 1) flag = 1;
    cout << ((flag) ? "YES" : "NO") << endl;
  }
  return 0;
}
