#include <iostream>
using namespace std;
#define maxh 100
class Matrix
{
public:
    int r,c;
    int s[maxh][maxh];
    Matrix operator + ( const Matrix &b);
    Matrix operator - ( const Matrix &b);
};

Matrix Matrix::operator + (const Matrix &b)
{
    Matrix res; res.r =r,res.c =c;
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++)
            res.s[i][j]=s[i][j]+b.s[i][j];
    return res;
}

Matrix Matrix::operator - (const Matrix &b)
{
    Matrix res; res.r = r, res.c = c;
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++)
            res.s[i][j]=s[i][j]-b.s[i][j];
    return res;
}Matrix a,b,c;
int main()
{
    a.r=4;
	b.r=4;
    a.c=3;
	b.c=3;
    for(int i=0;i<a.r;i++)
        for(int j=0;j<a.c;j++)
			cin>>a.s[i][j];

    for(int i=0;i<b.r;i++)
        for(int j=0;j<b.c;j++)
            cin>>b.s[i][j];
            
    c=a+b;
    for(int i=0;i<c.r;i++) 
	{
        for(int j=0;j<c.c;j++)
            cout<<c.s[i][j]<<" ";
        cout<<endl;
    }
    return 0;
}