N, M = (int(i) for i in input().split())
avail = [0] * M
ends = []
for _ in range(N):
	time = 0
	for i, p in enumerate(map(int, input().split())):
		time = max(time, avail[i]) + p
		avail[i] = time
	ends.append(time)
print(" ".join(map(str, ends)))
14a5c8da68b46b938e74fe79a14962c6f1ba8e61
<mask token>

<mask token>
for _ in range(N):
    time = 0
    for i, p in enumerate(map(int, input().split())):
        time = max(time, avail[i]) + p
        avail[i] = time
    ends.append(time)
print(' '.join(map(str, ends)))

N, M = (int(i) for i in input().split())
avail = [0] * M
ends = []
for _ in range(N):
    time = 0
    for i, p in enumerate(map(int, input().split())):
        time = max(time, avail[i]) + p
        avail[i] = time
    ends.append(time)
print(' '.join(map(str, ends)))

N, M = (int(i) for i in input().split())
avail = [0] * M
ends = []
for _ in range(N):
	time = 0
	for i, p in enumerate(map(int, input().split())):
		time = max(time, avail[i]) + p
		avail[i] = time
	ends.append(time)
print(" ".join(map(str, ends)))