#include
#include
#include
#include
#include
#pragma GCC optimize("Ofast")
using ll = long long;
using ld = long double;
using namespace std;
vector> a;
ll find_min(vector v){
ll mn = pow(10,9);
for(auto i: v)
mn = min(i,mn);
return mn;
}
void f(ll n){
ll mn = find_min(a[n]);
for(ll i = 0; i < a[n].size(); i++)
a[n][i] *= mn;
}
signed main() {
ll n,m;
cin >> n >> m;
for(ll i = 0; i < n; i++){
vector temp(m);
for(ll j = 0; j < m; j++)
cin >> temp[j];
a.push_back(temp);
}
for(ll i = 0; i < n; i++)
f(i);
for(ll i = 0; i < n; i++){
for(ll j = 0; j < m; j++)
cout << a[i][j] << " ";</strong>
cout << "\n";</strong>
}
}