#include <iostream>
using namespace std;
int a[101][101], n, m;
int main(){
cin >> n >> m;
for (int i = 1 ;i <= n ; ++i)
for(int j = 1 ; j <= m ; ++j)
cin >> a[i][j];
for(int i =1 ; i <= n ; ++i)
for(int j = 1 ; j < m ; ++j)
for(int k = j + 1 ; k <= m ; k ++)
if(a[i][j] > a[i][k])
{
int aux = a[i][j];
a[i][j] = a[i][k];
a[i][k] = aux;
}
for (int i = 1 ;i <= n ; ++i){
for(int j = 1 ; j <= m ; ++j)
cout << a[i][j] << " ";
cout << endl;
}
return 0;
}