Distributed Inference in Tree Networks using Coding Theory