#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int mod = 1e9 + 7;
int dp[100005][3];
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int j = 0;
  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;
  while (j < s.size()) {
    dp[j + 1][0] = dp[j][0];
    dp[j + 1][1] = dp[j][1];
    dp[j + 1][2] = dp[j][2];
    dp[j + 1][s[j] - 'x']++;
    j++;
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    l--;
    int x = dp[r][0] - dp[l][0];
    int y = dp[r][1] - dp[l][1];
    int z = dp[r][2] - dp[l][2];
    if (r - l < 3) {
      cout << "YES" << endl;
      continue;
    }
    if (max(x, max(y, z)) - min(x, min(y, z)) < 2) {
      cout << "YES" << endl;
      continue;
    }
    cout << "NO" << endl;
  }
}
