#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167779216")
using namespace std;
struct point {
  int x, y, z;
};
point a[123456];
int main() {
  string s;
  int n;
  cin >> s >> n;
  for (int i = 0; i < s.size(); i++) {
    if (i != 0) a[i] = a[i - 1];
    if (s[i] == 'x') a[i].x++;
    if (s[i] == 'y') a[i].y++;
    if (s[i] == 'z') a[i].z++;
  }
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    int x[3], all = 0;
    x[0] = a[r].x - a[l].x;
    x[1] = a[r].y - a[l].y;
    x[2] = a[r].z - a[l].z;
    if (s[l] == 'x') x[0]++;
    if (s[l] == 'y') x[1]++;
    if (s[l] == 'z') x[2]++;
    sort(x, x + 3);
    all = x[0] + x[1] + x[2];
    if (all < 3) {
      cout << "YES" << endl;
      continue;
    }
    if ((x[2] - x[1] == 1 && x[1] == x[0]) ||
        (x[2] == x[1] && x[1] - x[0] == 1) || (x[0] == x[1] && x[2] == x[1]))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
