#include void main(void){ int h,w; scanf("%d %d",&h,&w); int numList[h*w]; for(int i = 0 ; i < h*w ; i++ ){ scanf("%d",&numList[i]); } for(int i = 0 ; i < h*w ; i++ ){ for(int j = i ; j < h*w ; j++ ){ if(numList[i] > numList[j]){ int num = numList[i]; numList[i] = numList[j]; numList[j] = num; } } } int count = 0; for(int i = 0 ; i < h ; i++ ){ for(int j = 0 ; j < w ; j++ ){ printf("%d",numList[count]); if(j != w-1){ printf(" "); } count++; } printf("\n"); } }