#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
char a[MAXN];
int sum[MAXN][3];
int main() {
  int n;
  cin >> a;
  n = strlen(a);
  for (int i = 1; i <= n; i++) {
    sum[i][0] = sum[i - 1][0];
    sum[i][1] = sum[i - 1][1];
    sum[i][2] = sum[i - 1][2];
    sum[i][a[i - 1] - 'x']++;
  }
  int m;
  cin >> m;
  while (m--) {
    int l, r;
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES" << endl;
      continue;
    }
    int b[3];
    b[0] = sum[r][0] - sum[l - 1][0];
    b[1] = sum[r][1] - sum[l - 1][1];
    b[2] = sum[r][2] - sum[l - 1][2];
    sort(b, b + 3);
    if (b[2] - b[0] > 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
