Who won the war of Three Kingdoms?