Not passing all testcases, What am I missing?

@Ak07 you have to print in sorted order

still not able to pass one testcase now

@Ak07 when there is no answer print 0

Thanks,It passed all cases