All test cases not clearing

sir can u please see why all test cases are not clearing… here i have taken 2 loops… my first output is matching and second is also correct but in reverse order… how to correct it

The output must be in sorted order. Each pair must be in increasing order. Try to do it with sorting in O(nlogn) using the two pointer approach. There must be a video related to this question. You can refer that.

ok… thank u sir… will try it