h, w , n = map(int, input().split())
tile = [[0]*20 for _ in range(h)]
def draw(r, c, t, x):
for i in range(h):
for j in range(w):
if abs(r-i)+abs(c-j) <= t:
tile[i][j] += x
for i in range(n):
r, c, t, x = map(int, input().split())
draw(r, c, t, x)
for i in range(h):
for j in range(w):
print(tile[i][j], end=' ')
print()