#include using namespace std; int main() { int N; cin >> N; vector> ans; for (int x = 0; 3 * x * x <= N; x++) { for (int y = x; 2 * x * y + y * y <= N; y++) { if (x + y > 0 && (N - x * y) % (x + y) == 0) { int z = (N - x * y) / (x + y); if (z >= y) { if (x == y && y == z) { ans.push_back(make_tuple(x, x, x)); } else if (x == y) { ans.push_back(make_tuple(x, x, z)); ans.push_back(make_tuple(x, z, x)); ans.push_back(make_tuple(z, x, x)); } else if (y == z) { ans.push_back(make_tuple(x, y, y)); ans.push_back(make_tuple(y, x, y)); ans.push_back(make_tuple(y, y, x)); } else if (x == z) { ans.push_back(make_tuple(x, x, y)); ans.push_back(make_tuple(x, y, x)); ans.push_back(make_tuple(y, x, x)); } else { ans.push_back(make_tuple(x, y, z)); ans.push_back(make_tuple(x, z, y)); ans.push_back(make_tuple(y, x, z)); ans.push_back(make_tuple(y, z, x)); ans.push_back(make_tuple(z, x, y)); ans.push_back(make_tuple(z, y, x)); } } } } } cout << ans.size() << '\n'; for (auto [x, y, z]: ans) { printf("%d %d %d\n", x, y, z); } }