n=gets.to_i-3 0.upto(n){|a|0.upto(n-a){|b|c=n-a-b;puts [a+1,b+1,c+1]*' '}}