import Data.Array.IO
import Control.Applicative
import Data.List
import Control.Monad

getLineN :: Int -> IO [String]
getLineN n = replicateM n getLine

getNum = read <$> getLine :: IO Int
getNumList = map read.words <$> getLine :: IO [Int]

primes = eratosthenes 55555

main = do
    n <- getNum
    putStrLn.format.head $ filter (all (not.isPrime.sum). combinationsN 5) $ combinationsN n primes

format [] = []
format (x:xs) = show x ++ " " ++ format xs

isPrime x = f x primes where
    f _ [] = False
    f x (v:vs) = if x < v then False else if x == v then True else f x vs

eratosthenes :: Integer -> [Integer]
eratosthenes n =
    let primes = [2..n]
        recursion ms = 
          case ms of
            [] -> []
            (m:_) -> m : recursion [x | x <- ms, x `mod` m /= 0]
    in  recursion primes

combinationsN :: Int -> [a] -> [[a]]
combinationsN 0 _      = [[]]
combinationsN _ []     = []
combinationsN n (x:xs) = (x:) `map` (combinationsN (n-1) xs) ++ combinationsN n xs