#include <bits/stdc++.h>
using namespace std;
string s;
int n, x[110000] = {0}, y[110000] = {0}, z[110000] = {0};
int main() {
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'x')
      x[i]++;
    else if (s[i] == 'y')
      y[i]++;
    else
      z[i]++;
    if (i > 0) {
      x[i] += x[i - 1];
      y[i] += y[i - 1];
      z[i] += z[i - 1];
    }
  }
  int l, r;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    l--;
    r--;
    if ((abs(x[r] - x[l - 1] - (y[r] - y[l - 1])) <= 1 &&
         abs(x[r] - x[l - 1] - (z[r] - z[l - 1])) <= 1 &&
         abs(z[r] - z[l - 1] - (y[r] - y[l - 1])) <= 1 && x[r] - x[l - 1] &&
         z[r] - z[l - 1] && y[r] - y[l - 1]) ||
        r - l < 2)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
