#include <iostream>
using namespace std;
class Matrix
{
public:
Matrix();
friend Matrix operator+(Matrix &,Matrix &);
friend ostream& operator<<(ostream&,Matrix&);
friend istream& operator>>(istream&,Matrix&);
private:
int mat[2][3];
};
Matrix::Matrix()
{
for(int i=0;i<2;++i)
for(int j=0;j<3;++j)
mat[i][j]=0;
}
Matrix operator+(Matrix &m1,Matrix &m2)
{
Matrix m;
for(int i=0;i<2;++i)
for(int j=0;j<3;++j)
{
m.mat[i][j]=m1.mat[i][j]+m2.mat[i][j];
}
return m;
}
ostream& operator<<(ostream&out,Matrix&m)
{
for(int i=0;i<2;++i)
{
for(int j=0;j<2;++j)
out<<m.mat[i][j]<<" ";
out<<m.mat[i][2]<<endl;
}
return out;
}
istream& operator>>(istream&in,Matrix&m)
{
for(int i=0;i<2;++i)
for(int j=0;j<3;++j)
{
in>>m.mat[i][j];
}
return in;
}
int main()
{
Matrix a,b,c;
cin>>a;
cin>>b;
c=a+b;
cout<<c<<endl;
return 0;
}