#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cout.precision(20);
  string s;
  int n, m, l, r;
  int x, y, z;
  cin >> s;
  n = s.length();
  int c[n][3];
  c[0][0] = c[0][1] = c[0][2] = 0;
  c[1][0] = c[1][1] = c[1][2] = 0;
  c[1][s[0] - 'x']++;
  for (int i = 2; i < s.length() + 1; i++) {
    c[i][0] = c[i - 1][0], c[i][1] = c[i - 1][1], c[i][2] = c[i - 1][2];
    c[i][s[i - 1] - 'x']++;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES" << endl;
      continue;
    }
    x = c[r][0] - c[l - 1][0];
    y = c[r][1] - c[l - 1][1];
    z = c[r][2] - c[l - 1][2];
    if (abs(x - y) > 1 or abs(y - z) > 1 or abs(x - z) > 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}
