#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    
    vector<int> max_ages(n); // 存储每行的最大年龄
    
    for (int i = 0; i < n; ++i) {
        int current_max = 0; // 初始化当前行的最大值
        for (int j = 0; j < m; ++j) {
            int age;
            cin >> age;
            if (age > current_max) {
                current_max = age;
            }
        }
        max_ages[i] = current_max; // 记录当前行的最大值
    }
    
    // 输出每行的最大年龄
    for (int max : max_ages) {
        cout << max << endl;
    }
    
    return 0;
}

/**************************************************************
	Problem: 1996
	User: fuyijun
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2072 kb
****************************************************************/