#include<bits/stdc++.h>
const int maxn=1e5;
inline const void read(int &a)
{
char c=getchar();int b=1;a=0;
while(c<'0'||c>'9'){if(c=='-')b=-1;c=getchar();}
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
a*=b;
}
inline const void write(int a)
{
if(a<0){putchar('-');a=-a;}
if(a>9)write(a/10);
putchar(a%10+'0');
}
inline const int lowbit(int a)
{
return a&(-a);
}
int sum[maxn],n,m,t;
inline const void modify(int a,int b)
{
while(a<=n)
{
sum[a]+=b;
a+=lowbit(a);
}
}
inline const int query(int a)
{
int ans=0;
while(a)
{
ans+=sum[a];
a-=lowbit(a);
}
return ans;
}
struct monotonous_queue
{
int que[maxn],start,end,loc[maxn];
inline const void init(){start=0;end=0;que[0]=loc[0]=0;}
inline const void push(int a,int i)
{
que[++end]=a;loc[end]=i;
while(end>start&&a<que[end-1]){que[--end]=a;loc[end]=i;}
}
inline const void pop(int i)
{
if(loc[start]==i)start++;
}
}s;
int a[maxn],ex[maxn],l,r;
int main()
{
//freopen("1.in","r",stdin);
//freopen("10.out","w",stdout);
read(n);read(m);read(t);
memset(sum,0,sizeof(sum));
ex[0]=0;
while(m)
{
s.init();l=r=0;
for(int i=1;i<=n;i++)
{
read(a[i]);
ex[i]=ex[i-1]+a[i];
s.pop(i-t-1);
s.push(ex[i],i);
if(ex[i]-s.que[s.start]>ex[r]-ex[l])
{
r=i;
l=s.loc[s.start];
}
else
if(ex[i]-s.que[s.start]==ex[r]-ex[l]&&i-s.start>r-l)
{
r=i;
l=s.loc[s.start];
}
}
if(r){modify(l+1,1);modify(r+1,-1);}
m--;
}
for(int i=1;i<=n;i++){write(query(i));putchar(' ');}
return 0;
}