# your code goes here
import sys
while 1:
    
    N,M = map(int,input().split())
    list1 = []
    list2 = []
    for i in range(N):
        a = list(map(int,sys.stdin.readline().split()))
        list1.append(a)

    for j in range(N):
        b = list(map(int,sys.stdin.readline().split()))
        list2.append(b)
            

    for i in range(N):
        for j in range(M):
            list1[i][j] += list2[i][j]
        print(*list1[i])
    break