query: SELECT ?item
  WHERE {
    hint:Query hint:optimizer "None" .
    ?item wdt:P4638 ?thepeerageid .
    {
      ?item wdt:P21 wd:Q6581097 .
      ?item wdt:P735/wdt:P31 wd:Q11879590 .
    }
    UNION
    {
      ?item wdt:P21 wd:Q6581072 .
      ?item wdt:P735/wdt:P31 wd:Q12308941 .
    }
    
    ?item wdt:P735 ?given .
    FILTER (?given NOT IN (
      wd:Q16652258, # Joan (female)
      wd:Q1484457, # Joan (unisex)
      wd:Q18001597 # Christian (male)
    ))
    
    ?item p:P21 ?sexstatement .
    ?sexstatement prov:wasDerivedFrom ?sexref .
    ?sexref pr:P248 wd:Q21401824 .
    
  }
  LIMIT 50