#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.size();
  int count[3][n + 1];
  for (int i = 0; i < 3; ++i) count[i][0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) count[j][i + 1] = count[j][i];
    ++count[s[i] - 'x'][i + 1];
  }
  int q;
  cin >> q;
  while (q--) {
    int x, y, c[3];
    cin >> x >> y;
    --x;
    for (int i = 0; i < 3; ++i) c[i] = count[i][y] - count[i][x];
    sort(c, c + 3);
    if (y - x < 3)
      cout << "YES\n";
    else if (c[0] == c[1] && c[1] == c[2])
      cout << "YES\n";
    else if (c[0] + 1 == c[1] && c[0] + 1 == c[2])
      cout << "YES\n";
    else if (c[0] == c[1] && c[0] + 1 == c[2])
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
