what monarch is the ruler of a kingdom that is also ruled by barakzai dynasty?
Entity
m.03c9ym
Amānullāh Khān
class class entity
royalty.monarch royalty.kingdom m.0csf14
royalty.monarch royalty.kingdom royalty.royal_line
Monarch Kingdom Barakzai Dynasty
none none none
royalty.kingdom.rulers royalty.royal_line.kingdom_s_ruled
Rulers Kingdom(s) ruled
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX : <http://rdf.freebase.com/ns/> 
SELECT (?x0 AS ?value) WHERE {
SELECT DISTINCT ?x0  WHERE { 
?x0 :type.object.type :royalty.monarch . 
?x1 :type.object.type :royalty.kingdom . 
VALUES ?x2 { :m.0csf14 } 
?x1 :royalty.kingdom.rulers ?x0 . 
?x2 :royalty.royal_line.kingdom_s_ruled ?x1 . 
FILTER ( ?x0 != ?x1 && ?x0 != ?x2 && ?x1 != ?x2  )
}
}
(AND royalty.monarch (JOIN (R royalty.kingdom.rulers) (JOIN (R royalty.royal_line.kingdom_s_ruled) m.0csf14)))