intToBin :: Int -> [Int]
intToBin 0 = []
intToBin 1 = [1]
intToBin n = (mod n 2) : intToBin (div n 2)

weights :: Int -> [Int]
weights w = (filter (/= 0) . zipWith (*) ws . intToBin) w
    where ws = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]

main :: IO ()
main = interact $ unlines . map unwords . map (map show) . map weights . map read . lines