Given an n x n matrix, where every row and column is sorted in non-decreasing order. Print all elements of matrix in sorted order.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the matrix. Then the next line contains the n x n elements in row wise order.
Print the elements of the matrix in sorted order.