#include<iostream>
using namespace std;
int main ()
{
int n,m;
cin>>n>>m;
int a[100][100]={};
int b[100][100]={};
for (int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>a[i][j];
}
}
for (int o=0;o<n;o++)
{
for(int c=0;c<m;c++)
{
cin>>b[o][c];
}
}
for(int k=0;k<n;k++)
{
for(int s=0;s<m;s++)
{
a[k][s]=a[k][s]+b[k][s];
}
}
for (int l=0;l<n;l++)
{
for(int p=0;p<m;p++)
{
cout<<a[l][p]<<" ";
}
cout<<endl;
}
return 0;
}