16.1


#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];

};

// , , 
/* C++  */
Matrix::Matrix(){}
Matrix::Matrix operator+(Matrix &c1,Matrix &c2)
{
    Matrix c;
    for(int j=0;j<2;j++)
    for(int i=0;i<3;i++)
    {
        c.mat[j][i]=c1.mat[j][i]+c2.mat[j][i];
    }
    return c;
}
ostream& operator<<(ostream &output,Matrix &c)
{
    for(int j=0;j<2;j++)
    {
        for(int i=0;i<2;i++)
    {
        output<<c.mat[j][i]<<" ";
    }
    output<<c.mat[j][2]<<endl;
    }

    return output;
}
istream& operator>>(istream & input,Matrix & c)
{
    for(int j=0;j<2;j++)
     for(int k=0;k<3;k++)
     {
         input>>c.mat[j][k];
     }
    return input;
}
int main()

{

    Matrix a,b,c;

    cin>>a;

    cin>>b;

    c=a+b;

    cout<<c<<endl;

    return 0;

}