
nyan :: Int -> [Int]
nyan 0 = []
nyan x
    | even x = nextNyan
    | odd  x = 1 : nextNyan
        where nextNyan = map (* 2) $ nyan $ div x 2

solve :: Int -> IO ()
solve = putStrLn . unwords . map show . nyan

main :: IO ()
main = getContents
    >>= mapM_ solve . map read . lines