You are given k sorted arrays in the form of 2D integer matrix arr of size k*n.
Merge them into a single sorted array.
The first line contains two space-separated integers k and n.
The next k lines have n space-separated integers each denoting the elements of the array.
Space-separated results of the resultant sorted array.
3 4
1 3 7 10
3 3 6 8
2 4 7 9
1 2 3 3 3 4 6 7 7 8 9 10
1 <= k,n <= 500
-109 <= arrij <= 109