#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 5e5 + 100;
const double PI = 3.14159265359;
void solve() {
  string s;
  cin >> s;
  int n = s.size(), m;
  vector<int> x(n + 1, 0), y(n + 1, 0), z(n + 1, 0);
  for (int i = 1; i <= n; ++i) {
    if (s[i - 1] == 'x')
      x[i] = x[i - 1] + 1;
    else
      x[i] = x[i - 1];
    if (s[i - 1] == 'y')
      y[i] = y[i - 1] + 1;
    else
      y[i] = y[i - 1];
    if (s[i - 1] == 'z')
      z[i] = z[i - 1] + 1;
    else
      z[i] = z[i - 1];
  }
  cin >> m;
  while (m--) {
    int l, r;
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES" << endl;
      continue;
    }
    int xx = x[r] - x[l - 1], yy = y[r] - y[l - 1], zz = z[r] - z[l - 1];
    int a = min(xx, min(yy, zz)), b = max(xx, max(yy, zz));
    if (b - a > 1) {
      cout << "NO";
    } else
      cout << "YES";
    cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TTT = 1;
  while (TTT--) {
    solve();
    cout << endl;
  }
}
