#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
vector<string> parse(string s, string c) {
  int len = c.length(), p = -len, np;
  vector<string> ans;
  do {
    np = s.find(c, p + len);
    ans.push_back(s.substr(p + len, np - p - len));
    p = np;
  } while (p != string::npos);
  return ans;
}
int val(char ch) {
  if (ch == 'x') return 1;
  if (ch == 'y') return 2;
  if (ch == 'z') return 3;
}
int main() {
  ios_base::sync_with_stdio(0);
  string in;
  cin >> in;
  int n = in.size();
  int cont[100009][4];
  memset(cont, 0, sizeof(cont));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 3; j++) cont[i][j] = cont[i - 1][j];
    cont[i][val(in[i - 1])]++;
  }
  int m;
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES\n";
      continue;
    }
    vector<int> ans;
    for (int j = 1; j <= 3; j++) ans.push_back(cont[r][j] - cont[l - 1][j]);
    sort(ans.begin(), ans.end());
    if (ans[0] + 1 < ans[2]) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
  return 0;
}
