#include <bits/stdc++.h>
using namespace std;
int amount[200000][3];
int min(int a, int b) { return (a < b ? a : b); }
int min(int a, int b, int c) { return min(min(a, b), c); }
int max(int a, int b) { return a > b ? a : b; }
int max(int a, int b, int c) { return max(max(a, b), c); }
int main() {
  string s;
  cin >> s;
  int m;
  cin >> m;
  for (int i = 0; i < s.length(); ++i) {
    for (int k = 0; k < 3; ++k) {
      amount[i + 1][k] = amount[i][k] + (((int)(s[i] - 'x') == k) ? 1 : 0);
    }
  }
  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l;
    cin >> r;
    int x = amount[r][0] - amount[l - 1][0];
    int y = amount[r][1] - amount[l - 1][1];
    int z = amount[r][2] - amount[l - 1][2];
    int ma = max(x, y, z);
    int mi = min(x, y, z);
    if (ma - mi <= 1 || r - l < 2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
