#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, y, z;
  P() { x = y = z = 0; }
};
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int m;
  cin >> m;
  P sum;
  P *start = new P[100005], *end = new P[100005];
  for (int i = 0; i <= n; i++) {
    start[i] = sum;
    if (s[i] == 'x')
      sum.x++;
    else if (s[i] == 'y')
      sum.y++;
    else
      sum.z++;
  }
  sum.x = 0;
  sum.y = 0;
  sum.z = 0;
  for (int i = n; i >= 0; i--) {
    end[i] = sum;
    if (s[i] == 'x')
      sum.x++;
    else if (s[i] == 'y')
      sum.y++;
    else
      sum.z++;
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (b - a < 2) {
      cout << "YES" << endl;
      continue;
    }
    int x = sum.x - start[a].x - end[b].x;
    int y = sum.y - start[a].y - end[b].y;
    int z = sum.z - start[a].z - end[b].z;
    int mini = min(x, min(y, z));
    x -= mini;
    y -= mini;
    z -= mini;
    if (x > 1 || y > 1 || z > 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}
