                              b' = inc' x [i] b
                                  in go xs b' acc'

inverse9'i :: [Int] -> [(Int, [Int])]
inverse9'i xs = go (zip [0..] xs) b []
  where n = maximum xs
        b = new n :: BIT [Int]
        go []             b acc = zip xs (reverse acc)
        go (ix@(i, x):xs) b acc = let acc' = (b ! n \\ b ! x) : acc
                                      b' = inc' x [i] b
                                  in go xs b' acc'
inverse9'i xs = go (zip [0..] xs) b []
  where n = maximum xs
        b = new n :: BIT [Int]
        go []             b acc = zip xs (reverse acc)
        go (ix@(i, x):xs) b acc = let acc' = (b ! n \\ b ! x) : acc
                                      b' = inc' x [i] b
                                  in go xs b' acc'