#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
string s;
int f[3][maxn];
void precalc() {
  for (int i = 1; i <= s.length(); ++i) {
    for (int j = 0; j < 3; ++j) f[j][i] = f[j][i - 1];
    ++f[s[i - 1] - 'x'][i];
  }
}
bool check(int x, int s) { return x == s || x == s + 1; }
void solve(int l, int r) {
  int x = f[0][r] - f[0][l - 1];
  int y = f[1][r] - f[1][l - 1];
  int z = f[2][r] - f[2][l - 1];
  int s = (r - l + 1) / 3;
  if ((r - l + 1) < 3 || (check(x, s) && check(y, s) && check(z, s)))
    puts("YES");
  else
    puts("NO");
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  precalc();
  int q;
  cin >> q;
  for (int cas = 1; cas <= q; ++cas) {
    int l, r;
    cin >> l >> r;
    solve(l, r);
  }
  return 0;
}
