#include <iostream>
#include <vector>
using namespace std;
void solve(){
int m,n;
cin >> m >> n;
vector<vector<int>> a(m,vector<int>(n));
vector<int> res(m,1e9+7);
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
cin >> a[i][j];
res[i] = min(res[i],a[i][j]);
}
for(auto &i : res) cout << i << " ";
signed main(){
solve();
#include <iostream>
#include <vector>
using namespace std;
void solve(){
int m,n;
cin >> m >> n;
vector<vector<int>> a(m,vector<int>(n));
vector<int> res(m,1e9+7);
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
cin >> a[i][j];
res[i] = min(res[i],a[i][j]);
}
}
for(auto &i : res) cout << i << " ";
}
signed main(){
solve();
}