/*
Author: Nguyen Chi Thanh - High School for the Gifted - VNU.HCM (i2528)
*/
#include <bits/stdc++.h>
using namespace std;
/* START OF TEMPALTE */
// #define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define __builtin_popcount __builtin_popcountll
#define all(x) (x).begin(), (x).end()
#define BIT(x, i) (((x) >> (i)) & 1)
#define MASK(x) (1ll << (x))
#define SZ(a) ((int32_t)a.size())
#define debug(a, l, r) {for (int _i = (l); _i <= (r); ++_i) cout << (a)[_i] << ' '; cout << '\n';}
template<class X, class Y>
bool minimize(X &x, const Y &y) {
if (x > y) {
x = y;
return true;
} else return false;
}
template<class X, class Y>
bool maximize(X &x, const Y &y) {
if (x < y) {
x = y;
return true;
} else return false;
}
/* END OF TEMPALTE */
const int MAXN = 3e5 + 5;
int n, m, a[MAXN][25], aim;
int cnt[25], res[MAXN];
void init() {
cin >> n >> m;
aim = n / 2;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
cin >> a[i][j];
cnt[j] += a[i][j];
}
}
}
namespace subtask12 {
bool check() {
return n <= 5000;
}
void solve() {
for (int i = 1; i <= n; ++i) {
for (int j = i + 1; j <= n; ++j) {
int cur = 0;
for (int k = 1; k <= m; ++k) {
int vote = cnt[k] - a[i][k] - a[j][k];
if (vote >= aim) ++cur;
}
maximize(res[i], cur);
maximize(res[j], cur);
}
}
for (int i = 1; i <= n; ++i)
cout << res[i] << '\n';
}
}
signed main() {
#ifdef NCTHANH
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0);
cin.tie(nullptr); cout.tie(nullptr);
init();
if (subtask12::check()) return subtask12::solve(), 0;
return 0;
}