#include <iostream>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int matrix1[n][m];
int matrix2[n][m];
int matrix_sum[n][m] = {0};
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> matrix1[i][j];
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> matrix2[i][j];
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
matrix_sum[i][j] = matrix1[i][j] + matrix2[i][j];
cout << matrix_sum[i][j] << " ";
}
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbiwgbTsKCWNpbiA+PiBuID4+IG07CglpbnQgbWF0cml4MVtuXVttXTsKCWludCBtYXRyaXgyW25dW21dOwoJaW50IG1hdHJpeF9zdW1bbl1bbV0gPSB7MH07Cglmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKXsKCQlmb3IoaW50IGogPSAwOyBqIDwgbTsgaisrKXsKCQkJY2luID4+IG1hdHJpeDFbaV1bal07CgkJfQoJfQoJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKyl7CgkJZm9yKGludCBqID0gMDsgaiA8IG07IGorKyl7CgkJCWNpbiA+PiBtYXRyaXgyW2ldW2pdOwoJCX0KCX0KCWZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspewoJCWZvcihpbnQgaiA9IDA7IGogPCBtOyBqKyspewoJCQltYXRyaXhfc3VtW2ldW2pdID0gbWF0cml4MVtpXVtqXSArIG1hdHJpeDJbaV1bal07CgkJCWNvdXQgPDwgbWF0cml4X3N1bVtpXVtqXSA8PCAiICI7CgkJfQoJCWNvdXQgPDwgZW5kbDsKCX0KCXJldHVybiAwOwp9