public void solve() throws IOException {
    String input = nextLine();
    int m = nextInt();
    for (int x = 0; x < m; x++) {
      int l = nextInt();
      int r = nextInt();
      String sub = input.substring(l - 1, r);
      // System.out.println(sub);
      int xcount = 0;
      int ycount = 0;
      int zcount = 0;
      for (int y = 0; y < sub.length(); y++)
        if (sub.charAt(y) == 'x')
          xcount++;
        else if (sub.charAt(y) == 'y')
          ycount++;
        else if (sub.charAt(y) == 'z')
          zcount++;
      // System.out.println(xcount + " " + ycount + " " + zcount);
      int min = Math.min(xcount, ycount);
      min = Math.min(min, zcount);
      xcount -= min;
      ycount -= min;
      zcount -= min;
      if (xcount > 1 || ycount > 1 || zcount > 1)
        System.out.println("NO");
      else
        System.out.println("YES");
    }
  }