Solutions to unsolved problems on the minimal energies of two classes of trees