using System; using System.Text; using System.Collections.Generic; public class Solution { public static void Main() { var n = int.Parse(Console.ReadLine()); var str = new StringBuilder(); for (int a = 1; a * 3 <= n; a++) { for (int b = a; a + b + b <= n; b++) { for (int c = b; a + b + c <= n; c++) { str.Append($"{a} {b} {c}"); } } } Console.WriteLine(str); } }