package main import ( "bytes" "fmt" ) func main() { var N int fmt.Scan(&N) var out bytes.Buffer var i, j int for i = 1; i <= N; i++ { for j = i; i+j <= N; j++ { k := N - i - j if k >= j { out.WriteString(fmt.Sprintf("%d %d %d\n", i, j, k)) } } } fmt.Println(out.String()) }