#include <bits/stdc++.h>
using namespace std;
char q[100001];
int cnt[3][100001];
int main() {
  cin >> q;
  int length = strlen(q);
  for (int i = 0; i <= length; i++)
    if (i == 0)
      cnt[0][i] = cnt[1][i] = cnt[2][i] = 0;
    else {
      cnt[0][i] = cnt[0][i - 1];
      cnt[1][i] = cnt[1][i - 1];
      cnt[2][i] = cnt[2][i - 1];
      cnt[q[i - 1] - 'x'][i]++;
    }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    int x1 = cnt[0][b] - cnt[0][a - 1];
    int y1 = cnt[1][b] - cnt[1][a - 1];
    int z1 = cnt[2][b] - cnt[2][a - 1];
    if (max(x1, max(y1, z1)) - min(x1, min(y1, z1)) <= 1 || b - a < 2)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
