#include <bits/stdc++.h>
using namespace std;
int pre[100010][3];
int main() {
  int i, j, m, l, r, diff[3];
  string s;
  cin >> s >> m;
  for (i = 1; i <= s.size(); i++) {
    for (j = 0; j < 3; j++) pre[i][j] = pre[i - 1][j] + (s[i - 1] == 'x' + j);
  }
  while (m--) {
    scanf("%d%d", &l, &r);
    for (j = 0; j < 3; j++) diff[j] = pre[r][j] - pre[l - 1][j];
    sort(diff, diff + 3);
    if (r - l + 1 < 3 || diff[2] - diff[0] <= 1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
