query: SELECT ?item ?status ?cy ?dep
  WITH {
      SELECT ?item WHERE {
        ?item wdt:P31/wdt:P279* wd:Q16917 ; wdt:P17 wd:Q145 .
      } 
  } AS %UK
  WITH {
      SELECT ?item WHERE {
        ?item wdt:P131/wdt:P131* wd:Q25 .
      }
  } AS %Wales
  WHERE
  {
      INCLUDE %UK .
      INCLUDE %Wales .
      OPTIONAL { ?item rdfs:label ?cy . FILTER(lang(?cy)="cy") }
      OPTIONAL { ?item p:P31/ps:P31 wd:Q64578911 . BIND(wd:Q64578911 as ?status1) } BIND(COALESCE(?status1,wd:Q64624840) as ?status)
      OPTIONAL { ?item wdt:P131/wdt:P131* ?dep . ?dep wdt:P31 wd:Q15979307 }
  }