query: SELECT ?item ?itemLabel ?count ?countFemale ?countMale
  WITH {
    SELECT DISTINCT ?item ?human WHERE {
      ?human wdt:P108 ?item.
      { ?human (wdt:P106/wdt:P279*) wd:Q1622272 }
      UNION
      { ?human wdt:P106 wd:Q1622272 }
      ?item wdt:P463 wd:Q3212092.
    }
  } AS %humans
  WITH {
    SELECT ?human ?female ?male ?nonbinary WHERE {
      hint:SubQuery hint:optimizer "None". # optimizer seems to break nonbinary detection??
      INCLUDE %humans.
      OPTIONAL {
        ?human wdt:P21/wdt:P279* wd:Q6581072.
        BIND(1 AS ?female)
      }
      OPTIONAL {
        ?human wdt:P21/wdt:P279* wd:Q6581097.
        BIND(1 AS ?male)
      }
      OPTIONAL {
        ?human wdt:P21 ?gender.
        MINUS { ?gender wdt:P279* wd:Q6581097. }
        MINUS { ?gender wdt:P279* wd:Q6581072. }
        BIND(1 AS ?nonbinary)
      }
    }
  } AS %humansWithGender
  WITH {
    SELECT ?item (COUNT(?human) AS ?count) (SUM(?female) AS ?countFemale) (SUM(?male) AS ?countMale) (SUM(?nonbinary) AS ?countNonbinary) WHERE {
      INCLUDE %humans.
      INCLUDE %humansWithGender.
    }
    GROUP BY ?item
  } AS %items
  WHERE {
    INCLUDE %items.
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }