When 1,5 dibromopentane reacts with ammonia, among several products isolated is a water soluble compound A that rapidly gives a precipitate of AgBr with acidic AgNO3 solution. Compound A is unchanged when treated with dilute base, but treatment of A with concentrated NaOH and heat gives a new compound B (C10H19N) that decolorizes Br2 in CCl4. Compound B is identical to the product obtained from the reaction sequence below. Identify A and B.
4-pentanoic acid (SOCl2) -----> (piperidine) ---------> (1. LiALH4/ 2 H3O+) -----> B