#include <bits/stdc++.h>
using namespace std;
struct element {
  int x;
  int y;
  int z;
};
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string s;
  cin >> s;
  element arr[100010];
  int x = 0, y = 0, z = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    if (s[i] == 'x') {
      x++;
    } else if (s[i] == 'y') {
      y++;
    } else {
      z++;
    }
    arr[i + 1].x = x;
    arr[i + 1].y = y;
    arr[i + 1].z = z;
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (b - a <= 1) {
      cout << "YES" << endl;
      continue;
    }
    x = arr[b].x - arr[a - 1].x;
    y = arr[b].y - arr[a - 1].y;
    z = arr[b].z - arr[a - 1].z;
    if ((x == y && y == z && x == z) || (x == y && abs(z - x) == 1) ||
        (x == z && abs(y - x) == 1) || (y == z && abs(x - z) == 1)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
