#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000 + 7;
char str[MAX_N];
int dp[MAX_N][3];
int main() {
  scanf("%s", str + 1);
  int n = strlen(str + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) dp[i][j] = dp[i - 1][j];
    dp[i][str[i] - 'x']++;
  }
  int m;
  scanf("%d", &m);
  while (m--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (r - l + 1 < 3) {
      puts("YES");
      continue;
    }
    int a = dp[r][0] - dp[l - 1][0];
    int b = dp[r][1] - dp[l - 1][1];
    int c = dp[r][2] - dp[l - 1][2];
    if (abs(a - b) > 1 || abs(a - c) > 1 || abs(b - c) > 1)
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
