#include<iostream>
using namespace std;
class juzhen
{
private:
int arr[2][3];
public:
juzhen()
{
for(int i=0;i<2;i++)
{
for(int j=0;j<3;j++)
{
arr[i][j]=0;
}
}
}
void input();
void print();
juzhen operator+(juzhen &a);
friend istream&operator>>(istream&input,juzhen &a);
friend ostream&operator<<(ostream&output,juzhen &a);
};
juzhen juzhen::operator+(juzhen &a)
{
juzhen b;
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
b.arr[i][j]=arr[i][j]+a.arr[i][j];
}
}
return b;
}
istream&operator>>(istream &input,juzhen &a)
{
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
input >> a.arr[i][j];
}
}
return input;
}
ostream&operator<<(ostream &output,juzhen &a)
{
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
output<<a.arr[i][j]<<" ";
}
output << endl;
}
return output;
}
int main()
{
juzhen a, b,c;
cin>>a;
cin>>b;
c = a + b;
cout<<c;
return 0;
}