query: PREFIX wikibase: <http://wikiba.se/ontology#>
  PREFIX wd: <http://www.wikidata.org/entity/> 
  PREFIX wdt: <http://www.wikidata.org/prop/direct/>
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  
  SELECT DISTINCT ?country ?countryLabel WHERE {
    ?country wdt:P37 wd:Q809 . # find Polish official language
    { ?country wdt:P31/wdt:P279* wd:Q7275 } UNION { ?country wdt:P31/wdt:P279* wd:Q484652 } # in state or international organization
    SERVICE wikibase:label {
       bd:serviceParam wikibase:language "pl" .
     }
  }