#include <iostream>
using namespace std;

class three_d {
    int x, y, z;
public:
    three_d(int a, int b, int c) {x=a; y=b, z=c; }
    three_d operator+(const three_d& op2) const;
    friend ostream &operator<<(ostream &stream, const three_d &obj);
};
ostream &operator<< (ostream &stream, const three_d &obj)
{
    stream << obj.x << ", ";
    stream << obj.y << ", ";
    stream << obj.z << endl;
    return stream;
}
three_d three_d::operator+ (const three_d &op2) const
{
    return three_d(x + op2.x, y + op2.y, z + op2.z);
}

int main()
{
    three_d a(1, 2, 3), b(2, 3, 4), c(3, 4, 5);
    cout << a+b+c << endl;
    return 0;
}