#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int m;
  cin >> m;
  int dp[s.length()][3];
  for (int i = 0; i < s.length(); i++)
    for (int j = 0; j < 3; j++) dp[i][j] = 0;
  if (s[0] == 'x')
    dp[0][0]++;
  else if (s[0] == 'y')
    dp[0][1]++;
  else
    dp[0][2]++;
  for (int i = 1; i < s.length(); i++) {
    dp[i][0] = dp[i - 1][0];
    dp[i][1] = dp[i - 1][1];
    dp[i][2] = dp[i - 1][2];
    if (s[i] == 'x')
      dp[i][0]++;
    else if (s[i] == 'y')
      dp[i][1]++;
    else
      dp[i][2]++;
  }
  while (m--) {
    int a, b;
    cin >> a >> b;
    if (b - a + 1 < 3) {
      cout << "YES"
           << "\n";
      continue;
    }
    a = a - 1 - 1;
    b = b - 1;
    int cx = 0, cy = 0, cz = 0;
    cx = dp[b][0] - (a < 0 ? 0 : dp[a][0]);
    cy = dp[b][1] - (a < 0 ? 0 : dp[a][1]);
    cz = dp[b][2] - (a < 0 ? 0 : dp[a][2]);
    int x = min(cx, min(cy, cz));
    if (x >= 0) {
      if ((cx - x) <= 1 && (cy - x) <= 1 && (cz - x) <= 1) {
        cout << "YES "
             << "\n";
      } else {
        cout << "NO"
             << "\n";
      }
    }
  }
}
