#include <bits/stdc++.h>
using namespace std;
int a[100001], b[100001], c[100001];
string s;
int main() {
  int n, m, i, u, v, x, y, z, Min;
  getline(cin, s);
  n = s.length();
  a[0] = 0;
  b[0] = 0;
  c[0] = 0;
  for (i = 1; i <= n; i++) {
    a[i] = a[i - 1];
    b[i] = b[i - 1];
    c[i] = c[i - 1];
    if (s[i - 1] == 'x') a[i]++;
    if (s[i - 1] == 'y') b[i]++;
    if (s[i - 1] == 'z') c[i]++;
  }
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> u >> v;
    x = a[v] - a[u - 1];
    y = b[v] - b[u - 1];
    z = c[v] - c[u - 1];
    Min = min(x, y);
    Min = min(Min, z);
    x = x - Min;
    y = y - Min;
    z = z - Min;
    if ((v - u < 2) || ((x < 2) && (y < 2) && (z < 2)))
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
  return 0;
}
