#include <bits/stdc++.h>
using namespace std;
struct qq {
  int x, y, z;
} q[100006], q1;
int main() {
  string s;
  int m, l, r;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'x') {
      q[i].x = q[i - 1].x + 1;
      q[i].y = q[i - 1].y;
      q[i].z = q[i - 1].z;
    }
    if (s[i] == 'y') {
      q[i].x = q[i - 1].x;
      q[i].y = q[i - 1].y + 1;
      q[i].z = q[i - 1].z;
    }
    if (s[i] == 'z') {
      q[i].x = q[i - 1].x;
      q[i].y = q[i - 1].y;
      q[i].z = q[i - 1].z + 1;
    }
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES" << endl;
      continue;
    }
    q1.x = q[r - 1].x - q[l - 2].x;
    q1.y = q[r - 1].y - q[l - 2].y;
    q1.z = q[r - 1].z - q[l - 2].z;
    if (abs(q1.x - q1.y) > 1 || abs(q1.x - q1.z) > 1 || abs(q1.y - q1.z) > 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}
