#include <bits/stdc++.h>
using namespace std;
long long n, a[600000], b[600000], c[600000], l, r, g, ans;
vector<long long> v;
string s;
char f;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'x')
      a[i + 1] = 1;
    else if (s[i] == 'y')
      b[i + 1] = 1;
    else if (s[i] == 'z')
      c[i + 1] = 1;
  }
  for (int i = 1; i <= s.size(); i++) {
    a[i] += a[i - 1];
    b[i] += b[i - 1];
    c[i] += c[i - 1];
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    if (r - l + 1 < 3) {
      cout << "YES" << endl;
      continue;
    }
    long long a1 = a[r] - a[l - 1];
    long long b1 = b[r] - b[l - 1];
    long long c1 = c[r] - c[l - 1];
    if (abs(a1 - b1) > 1 || abs(a1 - c1) > 1 || abs(b1 - c1) > 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
