#include <bits/stdc++.h>
using namespace std;
char s[100005];
int n, m;
int g[100005];
using namespace std;
const int maxn = 100001;
int x[maxn], y[maxn], z[maxn];
int main() {
  int i, j, k, a, b;
  while (cin >> s) {
    n = strlen(s);
    scanf("%d", &m);
    memset(g, 0, sizeof(g));
    memset(x, 0, sizeof(x));
    memset(y, 0, sizeof(y));
    memset(z, 0, sizeof(z));
    for (i = 0; i < n; i++) {
      x[i + 1] = x[i] + (s[i] == 'x' ? 1 : 0);
      y[i + 1] = y[i] + (s[i] == 'y' ? 1 : 0);
      z[i + 1] = z[i] + (s[i] == 'z' ? 1 : 0);
    }
    while (m--) {
      k++;
      scanf("%d%d", &a, &b);
      if (b - a + 1 < 3) {
        cout << "YES" << endl;
        continue;
      }
      {
        int num1 = x[b] - x[a - 1];
        int num2 = y[b] - y[a - 1];
        int num3 = z[b] - z[a - 1];
        if ((num1 >= (b - a + 1) / 3 && num2 >= (b - a + 1) / 3 &&
             num3 >= (b - a + 1) / 3)) {
          if ((num1 - (b - a + 1) / 3) <= 1 && (num2 - (b - a + 1) / 3) <= 1 &&
              (num3 - (b - a + 1) / 3) <= 1)
            cout << "YES" << endl;
          else
            cout << "NO" << endl;
        } else
          cout << "NO" << endl;
      }
    }
  }
}
