#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, cnt[N][3];
char ch[N];
int main() {
  scanf("%s", ch + 1);
  n = strlen(ch + 1);
  for (int i = 1; i <= n; ++i) ch[i] -= 'x';
  for (int i = 1; i <= n; ++i)
    cnt[i][0] = cnt[i - 1][0] + (ch[i] == 0),
    cnt[i][1] = cnt[i - 1][1] + (ch[i] == 1),
    cnt[i][2] = cnt[i - 1][2] + (ch[i] == 2);
  scanf("%d", &m);
  int x, y, z, l, r;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &l, &r);
    --l;
    x = cnt[r][0] - cnt[l][0];
    y = cnt[r][1] - cnt[l][1];
    z = cnt[r][2] - cnt[l][2];
    if (max(x, max(y, z)) - min(x, min(y, z)) <= 1 || r - l < 3)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
