N, M = map(int, input().split())
list_a = []
list_b = []
list_c = []
for i in range(N):
list_a = list(map(int, input().split()))
list_b.append(list_a)
for i in range(M):
list_c = list(map(int, input().split()))
for j in range(N):
print(list_b[i][j]+list_c[j], end=' ')
print()
TiwgTSA9IG1hcChpbnQsIGlucHV0KCkuc3BsaXQoKSkKCmxpc3RfYSA9IFtdCmxpc3RfYiA9IFtdCmxpc3RfYyA9IFtdCgpmb3IgaSBpbiByYW5nZShOKToKICAgIGxpc3RfYSA9IGxpc3QobWFwKGludCwgaW5wdXQoKS5zcGxpdCgpKSkKICAgIGxpc3RfYi5hcHBlbmQobGlzdF9hKQpmb3IgaSBpbiByYW5nZShNKToKICAgIGxpc3RfYyA9IGxpc3QobWFwKGludCwgaW5wdXQoKS5zcGxpdCgpKSkKICAgIGZvciBqIGluIHJhbmdlKE4pOgogICAgICAgIHByaW50KGxpc3RfYltpXVtqXStsaXN0X2Nbal0sIGVuZD0nICcpCiAgICBwcmludCgpCiAgICA=