#include <bits/stdc++.h>
using namespace std;
long long int r, j, l, m, c, n, s, f, q, i, p, k, d, t, u, e, g;
string s1, s2, s3, s4;
long long int x[1000001], y[1000001], z[1000001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s1;
  for (long long int i = 0; i < s1.size(); i++) {
    if (s1[i] == 'x') {
      x[i + 1] = x[i] + 1;
      y[i + 1] = y[i];
      z[i + 1] = z[i];
    } else if (s1[i] == 'y') {
      y[i + 1] = y[i] + 1;
      x[i + 1] = x[i];
      z[i + 1] = z[i];
    } else {
      x[i + 1] = x[i];
      y[i + 1] = y[i];
      z[i + 1] = z[i] + 1;
    }
  }
  cin >> n;
  while (n--) {
    cin >> p >> q;
    long long int x1 = 0, y1 = 0, z1 = 0;
    if (p == 1)
      x1 = x[q];
    else
      x1 = x[q] - x[p - 1];
    if (p == 1)
      y1 = y[q];
    else
      y1 = y[q] - y[p - 1];
    if (p == 1)
      z1 = z[q];
    else
      z1 = z[q] - z[p - 1];
    vector<long long int> v = {x1, y1, z1};
    sort(v.begin(), v.end());
    x1 = v[0], y1 = v[1], z1 = v[2];
    if (q - p < 2)
      cout << "YES";
    else if ((x1 == y1 && (z1 - y1) <= 1) || (y1 == z1 && y1 - x1 <= 1))
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
}
