#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 100;
int n;
int sum[4][maxn];
string s;
int main() {
  ios::sync_with_stdio(false);
  cin >> s;
  n = (int)(s).size();
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 3; ++j)
      sum[j][i + 1] = sum[j][i] + (s[i] == (char)('x' + j));
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r;
    int nx = sum[0][l - 1] - sum[0][r];
    int ny = sum[1][l - 1] - sum[1][r];
    int nz = sum[2][l - 1] - sum[2][r];
    if (abs(nx - ny) <= 1 && abs(nx - nz) <= 1 && abs(nz - ny) <= 1 ||
        r - (l - 1) < 3)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
