#include <bits/stdc++.h>
using namespace std;
typedef long double real;
string s;
int cnt[3][100001];
int m;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    for (int k = 0; k < 3; ++k) {
      cnt[k][i + 1] = cnt[k][i];
    }
    ++cnt[s[i] - 'x'][i + 1];
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    int l, r;
    scanf("%d %d", &l, &r);
    int sz = r - l + 1;
    if (sz < 3) {
      puts("YES");
      continue;
    }
    int num = sz / 3;
    int t = 0;
    for (int k = 0; k < 3; ++k) {
      int ch = cnt[k][r] - cnt[k][l - 1];
      if (ch == num) {
        continue;
      }
      if (ch == num + 1) {
        ++t;
        continue;
      }
      t = 3;
    }
    if (t == sz % 3) {
      puts("YES");
    } else {
      puts("NO");
    }
  }
}
