Recursion-Dictionary Order(Larger)

two test cases show wrong answer

my code:

In which order I have to print?