query: SELECT DISTINCT ?item ?itemLabel ?enddate WHERE {
    ?item wdt:P131* wd:Q365 .
    ?item p:P31 ?statementNode .
    ?statementNode ps:P31/wdt:P279* wd:Q16970 .
    OPTIONAL {
      ?statementNode pq:P582 ?enddate .
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language 'de,en' }
  }