#include <bits/stdc++.h>
using namespace std;
int arr[3][100005];
int main() {
  memset(arr, 0, sizeof(arr));
  string str;
  cin >> str;
  int len, flag;
  for (int i = 0; i < str.size(); i++) {
    arr[0][i + 1] = arr[0][i];
    arr[1][i + 1] = arr[1][i];
    arr[2][i + 1] = arr[2][i];
    arr[str[i] - 'x'][i + 1]++;
  }
  int q;
  int l, r;
  cin >> q;
  int cc = 0;
  while (q--) {
    cc = 0;
    cin >> l >> r;
    len = (r - l + 1);
    if (len < 3)
      cout << "YES" << endl;
    else {
      flag = 0;
      for (int j = 0; j < 3 && flag == 0; j++) {
        if ((arr[j][r] - arr[j][l - 1]) < (len / 3)) flag = 1;
        if ((arr[j][r] - arr[j][l - 1] - (len / 3)) > 0) cc++;
      }
      if (flag == 1)
        cout << "NO" << endl;
      else if (len % 3 == 0 || len % 3 == 1)
        cout << "YES" << endl;
      else {
        if (cc == 2)
          cout << "YES" << endl;
        else
          cout << "NO" << endl;
      }
    }
  }
}
