#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
using namespace std;
void solution() {
  string s;
  int n, l, r, dp1[100005], dp2[100005], dp3[100005];
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    dp1[i + 1] = dp1[i];
    dp2[i + 1] = dp2[i];
    dp3[i + 1] = dp3[i];
    if (s[i] == 'x') {
      dp1[i + 1] = dp1[i] + 1;
    } else if (s[i] == 'y') {
      dp2[i + 1] = dp2[i] + 1;
    } else {
      dp3[i + 1] = dp3[i] + 1;
    }
  }
  cin >> n;
  while (n--) {
    cin >> l >> r;
    int x = dp1[r] - dp1[l - 1];
    int y = dp2[r] - dp2[l - 1];
    int z = dp3[r] - dp3[l - 1];
    if (r - l + 1 < 3 || (abs(x - y) <= 1 && abs(x - z) <= 1 &&
                          abs(y - z) <= 1 && x && y && z)) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (int i = 1; i <= t; i++) {
    solution();
  }
}
