from sys import stdin
def g(h,w,a1,r,c,t,x):
a1[r][c]+=x
for i in range (h):
for j in range(w):
if(i==r and j==c):
continue
xy=abs(i-r)+abs(j-c)
if (xy<=t):
a1[i][j]+=x
return a1
h,w,n=map(int,stdin.readline().split())
a1=[[0]*w for _ in range (h)]
for _ in range (n):
r,c,t,x=map(int,stdin.readline().split())
a1=g(h,w,a1,r,c,t,x)
for k in a1:
print(*k,sep=" ")