When was Charles VI, Holy Roman Emperor, the King of Hungary?
SELECT ?value WHERE { wd:Q150665 p:P39 ?s . ?s ps:P39 wd:Q6412254 . ?s pq:P580 ?value}
charles vi, holy roman emperor: Q150665 king of hungary: Q6412254