import java.util.*; import static java.lang.System.*; import java.io.PrintWriter; public class Main { static void solve (int n) { PrintWriter pw = new PrintWriter(System.out); int k; for (int i=1; i<=n/3; i++) { for (int j=i; j<=n/2; j++) { k = n-i-j; if (k>=j) {pw.println(i+" "+j+" "+k);} else {break;} } } } public static void main(String[] args) { int n = sc.nextInt(); solve(n); } static Scanner sc = new Scanner(System.in); }