Replace Branches with new ones

Hi! I have a tree with 19 branches {0;0;0} to {0;0;18}. Each branch has 26 indices (the number varies as per the inputs. So the number of indices varies between say 10 and 26). I want to replace the branches {0;0;2} to {0;0;4} with new branches (basically replace the data in those branches) and do this while retaining the structure of the tree.

How do i do this?