A word and number arrangement machine rearranges an input line step by step, following a rule. Here is an illustration of the input and the steps:
Input: pot 46 66 umbrella night 60
Step I: pot 46 66 umbrella 60 night
Step II: 46 66 umbrella 60 pot night
Step III: 46 66 60 umbrella pot night
Following the same rule, the machine is given this input: kite 87 toy 33 mango 39
In Step III, which element is 3rd from the left end?
Rule (from the illustration): In each step the word that comes first in the dictionary, of those not yet arranged, moves to the right end, before the words already arranged; numbers keep their order.
For the new input: Step I: 87 toy 33 mango 39 kite; Step II: 87 toy 33 39 mango kite; Step III: 87 33 39 toy mango kite.
Answer: 39