primes = 2 : f [3] [3,5..]
  where
    f (x:xs) ys = let (ps, qs) = span (< x^2) ys in ps ++ f (xs ++ ps) [z | z<-qs, mod z x /= 0]

main = do
  n <- readLn :: IO Int

  putStrLn $ unwords . map show . take n $ filter (\x -> mod x 10 == 1) $ takeWhile (<=55555) primes
