#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> vx(n + 1), vy(n + 1), vz(n + 1);
  vx[0] = 0;
  vy[0] = 0;
  vz[0] = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'x')
      vx[i + 1] = vx[i] + 1;
    else
      vx[i + 1] = vx[i];
    if (s[i] == 'y')
      vy[i + 1] = vy[i] + 1;
    else
      vy[i + 1] = vy[i];
    if (s[i] == 'z')
      vz[i + 1] = vz[i] + 1;
    else
      vz[i + 1] = vz[i];
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    int x = vx[r] - vx[l - 1];
    int y = vy[r] - vy[l - 1];
    int z = vz[r] - vz[l - 1];
    if (x < y) swap(x, y);
    if (x < z) swap(x, z);
    if (y < z) swap(y, z);
    if ((x + y + z) <= 2)
      cout << "YES" << endl;
    else {
      if (x > (z + 1))
        cout << "NO" << endl;
      else
        cout << "YES" << endl;
    }
  }
  return 0;
}
