#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
map<char, int> mp[MAXN];
char s[MAXN];
int n, m, l, r;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) mp[i]['x'] = mp[i]['y'] = mp[i]['z'] = 0;
  for (int i = 1; i <= n; i++) {
    for (char c = 'x'; c <= 'z'; c++) mp[i][c] = mp[i - 1][c];
    mp[i][s[i]]++;
  }
  scanf("%d", &m);
  while (m--) {
    scanf("%d%d", &l, &r);
    map<char, int> ct;
    for (char c = 'x'; c <= 'z'; c++) ct[c] = mp[r][c] - mp[l - 1][c];
    int m1 = ct['x'], m2 = ct['y'], m3 = ct['z'], a1 = max(m1, max(m2, m3)),
        a3 = min(m1, min(m2, m3)), a2 = m1 + m2 + m3 - a1 - a3;
    int ans;
    if (r - l <= 1)
      ans = 1;
    else if (a1 == a3)
      ans = 1;
    else if (a1 - a3 == 1)
      ans = 1;
    else
      ans = 0;
    if (ans)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
