Problem in passing all testcases

my code is working fine for the given input but doesnt pass all the test cases.
code link : https://ide.codingblocks.com/s/85145

Hi @himanshukumarclassic37.hk
see your test you are getting all the pairs but in some cases you are not able to print them in dictionary order.when you input 2134 you output is not in the correct dictionary format.

when i am using collections.sort in my program i am able to pass my 2nd and 4th test case but when i am not using it my 1st and 3rd test case are passing.Can u plzz correct my code .

Hi,
you can have a look at this.

can u plzz check ur code its not returning anything on the console.

Hi the code is perfectly running on hackerblocks and accepting all the test cases.You can try again to run.

yeah i have compiled the code again and it is now working. Thanx for the help.