#include #define gcu getchar_unlocked #define pcu putc_unlocked #define all(x) x.begin(),x.end() #define endln() pcu('\n',stdout) #define space() pcu(' ',stdout) using namespace std; int iin(){int r=0,s=1;int c=gcu();while(isspace(c))c=gcu();if(c=='-'){s=-1;c=gcu();}for(;!isspace(c);c=gcu())r=r*10+(c-'0');ungetc(c,stdin);return s*r;} void iout(int n){if(n<0){pcu('-',stdout);n=-n;}if(n<10){pcu('0'+n,stdout);return;}int i;char b[21];b[20]=0;for(i=20;n>0;b[--i]='0'+n%10,n/=10);fputs(b+i,stdout);} int main() { int n = iin(); for (int i = 1; i <= n / 3; i++) { for (int j = i; j <= (n - i) / 2; j++) { iout(i); space(); iout(j); space(); iout(n - i - j); endln(); } } }