#include <bits/stdc++.h>
using namespace std;
bool check(int cnt[]) {
  return (abs(cnt[0] - cnt[1]) <= 1 && abs(cnt[1] - cnt[2]) <= 1 &&
          abs(cnt[0] - cnt[2]) <= 1);
}
class ii {
 public:
  int x;
  int y;
  int z;
};
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  string temp;
  vector<ii> a;
  ii st;
  st.x = 0;
  st.y = 0;
  st.z = 0;
  a.push_back(st);
  for (int i = 1; i < s.length() + 1; i++) {
    ii temp;
    if (s[i - 1] == 'x') {
      temp.x = a[i - 1].x + 1;
      temp.y = a[i - 1].y;
      temp.z = a[i - 1].z;
    } else if (s[i - 1] == 'y') {
      temp.x = a[i - 1].x;
      temp.y = a[i - 1].y + 1;
      temp.z = a[i - 1].z;
    } else {
      temp.x = a[i - 1].x;
      temp.y = a[i - 1].y;
      temp.z = a[i - 1].z + 1;
    }
    a.push_back(temp);
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    int cnt[3] = {0, 0, 0};
    cnt[0] = abs(a[y].x - a[x - 1].x);
    cnt[1] = abs(a[y].y - a[x - 1].y);
    cnt[2] = abs(a[y].z - a[x - 1].z);
    cout << (y - x + 1 <= 2 || check(cnt) ? "YES" : "NO") << endl;
  }
}
