#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18;
const long long int mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  long long int n, i, l, x, y, z, a, b;
  string str;
  cin >> str;
  x = y = z = 0;
  l = str.length();
  vector<tuple<long long int, long long int, long long int>> v;
  v.push_back(make_tuple(0, 0, 0));
  for (long long int i = 0; i < l; i++) {
    if (str[i] == 'x')
      x++;
    else if (str[i] == 'y')
      y++;
    else
      z++;
    v.push_back(make_tuple(x, y, z));
  }
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> a >> b;
    x = get<0>(v[b]) - get<0>(v[a - 1]);
    y = get<1>(v[b]) - get<1>(v[a - 1]);
    z = get<2>(v[b]) - get<2>(v[a - 1]);
    if ((abs(x - y) > 1 || abs(x - z) > 1 || abs(y - z) > 1) &&
        (b - a + 1) >= 3)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}
