#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int prime = 9241;
const long double pi = acos(-1.);
int sum[3][100005];
int subsum(int a, int l, int r) {
  if (l == 0) return sum[a][r];
  return sum[a][r] - sum[a][l - 1];
}
int main() {
  string s;
  cin >> s;
  int n = s.size();
  sum[0][0] = sum[1][0] = sum[2][0] = 0;
  sum[s[0] - 'x'][0]++;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 3; j++) sum[j][i] = sum[j][i - 1];
    sum[s[i] - 'x'][i]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    int a = subsum(0, l, r), b = subsum(1, l, r), c = subsum(2, l, r);
    if (min(a, min(b, c)) + 1 >= max(a, max(b, c)) || r - l + 1 < 3)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
