#include <bits/stdc++.h>

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i * 3 <= n; i++) {
		for (int j = i; i + 2 * j <= n; j++) {
			int k = n - i - j;
			cout << i << " " << j << " " << k << endl;
		}
	}
	return 0;
}