#include <bits/stdc++.h>
using namespace std;
void CyBerForCe() {
  string s;
  cin >> s;
  long long m, l = s.length();
  cin >> m;
  long long a[l], b[l], c[l];
  a[0] = 0;
  b[0] = 0;
  c[0] = 0;
  for (long long i = 0; i < l; i++) {
    a[i + 1] = a[i];
    b[i + 1] = b[i];
    c[i + 1] = c[i];
    if (s[i] == 'x')
      a[i + 1]++;
    else if (s[i] == 'y')
      b[i + 1]++;
    else
      c[i + 1]++;
  }
  for (long long i = 0; i < m; i++) {
    long long l, r;
    cin >> l >> r;
    long long x = 0, y = 0, z = 0;
    x = a[r] - a[l - 1];
    y = b[r] - b[l - 1];
    z = c[r] - c[l - 1];
    if (r - l + 1 < 3)
      cout << "YES\n";
    else {
      if (x == y && y == z || x == y && (z - 1 == x || z + 1 == x) ||
          x == z && (y - 1 == x || y + 1 == x) ||
          y == z && (x - 1 == y || x + 1 == y))
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  CyBerForCe();
  return 0;
}
