import Control.Monad (guard) import Text.Printf (printf) main :: IO () main = mapM_ (\(a, b, c) -> printf "%d %d %d\n" a b c) . solve =<< readLn solve :: Int -> [(Int, Int, Int)] solve n = do a <- [1 .. n]; b <- [1 .. n]; c <- [1 .. n] guard $ a + b + c == n guard $ a <= b && b <= c return (a, b, c)