#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, l, r, dp[100005][3];
  string s;
  dp[0][0] = dp[0][1] = dp[0][2] = 0;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    dp[i + 1][0] = dp[i][0];
    dp[i + 1][1] = dp[i][1];
    dp[i + 1][2] = dp[i][2];
    dp[i + 1][s[i] - 'x'] = dp[i][s[i] - 'x'] + 1;
  }
  cin >> n;
  while (n--) {
    cin >> l >> r;
    int x = dp[r][0] - dp[l - 1][0];
    int y = dp[r][1] - dp[l - 1][1];
    int z = dp[r][2] - dp[l - 1][2];
    if (r - l + 1 < 3 ||
        (abs(x - y) <= 1 && abs(x - z) <= 1 && abs(y - z) <= 1)) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
}
