question_text: Which happened first, the defeat of the royal army at Gegodog, or the death of King Amangkurat?
decomposition: return when  was  the  defeat of the   royal army at Gegodog ;return when  was  the  death of King Amangkurat ;return which is the  lowest of #1 ,  #2