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: nest hill 83 19 34 29 jug van
Step I: 19 nest hill 83 34 29 jug van
Step II: 19 29 nest hill 83 34 jug van
Step III: 19 29 34 nest hill 83 jug van
Step IV: 19 29 34 83 nest hill jug van
Following the same rule, the machine is given this input: ink 25 86 umbrella vest 35 27 house
What is the final arrangement (the last step)?
Rule (from the illustration): In each step the smallest number not yet arranged moves to the left end, after the numbers already arranged; the words keep their order.
For the new input: Step I: 25 ink 86 umbrella vest 35 27 house; Step II: 25 27 ink 86 umbrella vest 35 house; Step III: 25 27 35 ink 86 umbrella vest house; Step IV: 25 27 35 86 ink umbrella vest house.
Answer: 25 27 35 86 ink umbrella vest house