#include #define int long long #define double long double using namespace std; const int MOD = 1000000007; const int INF = 1e14; using Graph = vector>; signed main(){ int H, W; cin >> H >> W; map num; for( int i = 0; i < H; i++ ){ for( int j = 0; j < W; j++ ){ int p; cin >> p; num[p]++; } } int now = 0; for( int i = 0; i < H; i++ ){ for( int j = 0; j < W; j++ ){ while( num[now] == 0 ){ now++; } cout << now << " "; num[now]--; } cout << endl; } }