#include <bits/stdc++.h>
using namespace std;
const int INF = 1e8 + 7;
const int MAX = 1e5 + 5;
const int MOD = 1e9 + 7;
string s;
int cx[MAX], cy[MAX], cz[MAX];
int main() {
  std::ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> s;
  cx[0] = 0;
  cy[0] = 0;
  cz[0] = 0;
  for (int i = 1; i <= s.size(); i++) {
    cx[i] = cx[i - 1];
    cy[i] = cy[i - 1];
    cz[i] = cz[i - 1];
    if (s[i - 1] == 'x') cx[i]++;
    if (s[i - 1] == 'y') cy[i]++;
    if (s[i - 1] == 'z') cz[i]++;
  }
  int m;
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    if ((r - l + 1) < 3) {
      cout << "YES\n";
      continue;
    }
    int x = cx[r] - cx[l - 1];
    int y = cy[r] - cy[l - 1];
    int z = cz[r] - cz[l - 1];
    if (x == 0 || y == 0 || z == 0) {
      cout << "NO\n";
      continue;
    }
    if (max(x, max(y, z)) - min(x, min(y, z)) <= 1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
