N = gets.to_i ans = (1..(N / 3)).map {|a| (a..((N - a) / 2)).map {|b| [a, b, N - a - b].join(' ')}} puts ans