#include <bits/stdc++.h>
const int MAXINT = 1111 * 1111 * 1111;
const long long MAXLINT = MAXINT * 1ll * MAXINT;
const long double EPS = 1e-10;
using namespace std;
int t[3][111111];
int get(int x, int y, int z) {
  int a[11111];
  int cnt = 0;
  for (int i = 0; i < x; i++) a[cnt++] = 0;
  for (int i = 0; i < y; i++) a[cnt++] = 1;
  for (int i = 0; i < z; i++) a[cnt++] = 2;
  int n = cnt;
  cnt = 0;
  int f = 1;
  while (f) {
    f = 0;
    cnt++;
    if (cnt > 100000) return 0;
    for (int i = 0; i < n - 2; i++) {
      if (a[i] == a[i + 1] && a[i] == a[i + 2]) {
        f = 1;
        continue;
      }
      if (((a[i] != 0) && (a[i + 1] != 1) && (a[i + 2] != 2)) ||
          ((a[i] != 0 && a[i + 1] != 2 && a[i + 2] != 1) ||
           ((a[i] != 2 && a[i + 1] != 1 && a[i + 2] != 0)))) {
        random_shuffle(a + i, a + i + 2);
        f = 1;
      }
    }
  }
  return 1;
}
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  int a[111111];
  for (int i = 0; i < s.size(); i++) a[i] = int(s[i] - 'x');
  memset(t, 0, sizeof(t));
  for (int i = 0; i < n; i++) {
    if (i != 0)
      for (int j = 0; j < 3; j++) t[j][i] = t[j][i - 1];
    t[a[i]][i]++;
  }
  int q[11];
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    q[0] = t[0][y] - t[0][x];
    q[1] = t[1][y] - t[1][x];
    q[2] = t[2][y] - t[2][x];
    q[a[x]]++;
    sort(q, q + 3);
    if (y - x >= 2) {
      if ((q[1] - q[0]) > 1 || (q[2] - q[1] > 1) ||
          (q[0] != q[1] && q[1] != q[2]))
        cout << "NO" << endl;
      else
        cout << "YES" << endl;
    } else
      cout << "YES" << endl;
  }
}
int main() { solve(); }
