#include using namespace std; int main() { int N; cin >> N; int maxa, a, b, c, counter = 0; maxa = floor(N/3); for (int i = 1; i <= maxa; i++) { a = i; for (int j = i; j <= (N - 2 * i); j++){ b = min(i + counter, N - i - counter); c = N - a - b; if (b > c){ counter = 0; continue; } cout << a << ' ' << b << ' ' << c << '\n'; counter++; } counter = 0; } return 0; }