#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
using namespace std;
//#define PI 3.1415926
//int n;
int main()
{
int n,m;
std::cin>>n>>m;
int a[2*n][m];
int b[n][m];
for(int i=1;i<=2*n;i++)
for(int j=1;j<=m;j++)
std::cin>>a[i][j];
for(int i=1;i<=n;++i)
{for(int j=1;j<=m;++j)
{b[i][j]=a[i][j]+a[i+m][j];
std::cout<<b[i][j]<<' ';
}
cout<<endl;
}
return 0;
}