#include <bits/stdc++.h>
using namespace std;
const long long M = 100005;
long long x[M], y[M], z[M];
long long cnt[3];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long m, l, r;
  string s;
  cin >> s;
  if (s[0] == 'x')
    x[0] = 1;
  else if (s[0] == 'y')
    y[0] = 1;
  else
    z[0] = 1;
  for (long long i = 1; i < s.size(); i++) {
    if (s[i] == 'x') {
      x[i] = x[i - 1] + 1;
      y[i] = y[i - 1];
      z[i] = z[i - 1];
    } else if (s[i] == 'y') {
      x[i] = x[i - 1];
      y[i] = y[i - 1] + 1;
      z[i] = z[i - 1];
    } else {
      x[i] = x[i - 1];
      y[i] = y[i - 1];
      z[i] = z[i - 1] + 1;
    }
  }
  cin >> m;
  while (m--) {
    cin >> l >> r;
    l--, r--;
    if (r - l + 1 < 3)
      cout << "YES";
    else {
      cnt[0] = (x[r] - x[l]);
      cnt[1] = (y[r] - y[l]);
      cnt[2] = (z[r] - z[l]);
      if (s[l] == 'x')
        cnt[0]++;
      else if (s[l] == 'y')
        cnt[1]++;
      else
        cnt[2]++;
      if (abs(cnt[0] - cnt[1]) > 1 || abs(cnt[1] - cnt[2]) > 1 ||
          abs(cnt[2] - cnt[0]) > 1)
        cout << "NO";
      else
        cout << "YES";
    }
    cout << '\n';
  }
  return 0;
}
