main = interact $ unlines.map (unwords.map show.lookups 1.flip zip weights.int2bin.read).lines

weights = [1,2,4,8,16,32,64,128,256,512]

int2bin :: Int -> [Int]
int2bin 0 = []
int2bin n = n `mod` 2 : int2bin (n `div` 2)

lookups :: Eq a => a -> [(a,b)] -> [b]
lookups _ []     = []
lookups n (x:xs) = if fst x == n then snd x : lookups n xs
                                 else lookups n xs