#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  vector<vector<int> > a(n + 1, vector<int>(3));
  vector<int> b(n + 1);
  for (int i = 1; i <= n; i++)
    if (s[i - 1] == 'x')
      b[i] = 0;
    else if (s[i - 1] == 'y')
      b[i] = 1;
    else
      b[i] = 2;
  for (int j = 0; j < 3; j++) a[0][j] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) a[i][j] = a[i - 1][j];
    a[i][b[i]]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    if (r - l < 2)
      cout << "YES" << endl;
    else {
      int q1 = a[r][0] - a[l - 1][0];
      int q2 = a[r][1] - a[l - 1][1];
      int q3 = a[r][2] - a[l - 1][2];
      if (abs(q1 - q2) <= 1 && abs(q1 - q3) <= 1 && abs(q2 - q3) <= 1)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
