what is the {end time} for {Korea} has {country} as {Later Three Kingdoms} ?
When was the last year Three Kingdoms period finish in Korea?
When did the Three Kingdoms period end in Korea?
SELECT ?w WHERE { ?t property:end_time ?w . ?t property:country resource:Later_Three_Kingdoms . resource:Korea property:country ?t }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q18097> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P17> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q698268> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q18097 p:P17 ?s . ?s ps:P17 wd:Q698268 . ?s pq:P582 ?value}