//! (c) WhiZTiM __ionogu(<_at_)>acm.org
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

struct Triples { 
	Triples() = default;
	Triples(unsigned aa, unsigned bb, unsigned cc): a(aa), b(bb), c(cc) {}
	unsigned a=0; unsigned b=0; unsigned c=0;
};
using vTriples = vector<Triples>;

Triples triples(size_t lower, size_t max, size_t num){
	Triples ans;
	for(size_t x=lower; x<max; x++)
		for(size_t y=x; y<max; y++)
			for(size_t z=y; z<max; z++)
				if((x*x + y*y == z*z) and x + y + z == num)
					return Triples(x, y, z);
	return ans;
}

int main() {
	auto t = triples(1, 1000, 1000);
	cout << t.a << ", " << t.b << ", " << t.c << '\n';
	cout << "Product: " << t.a * t.b * t.c << '\n';
	return 0;
}