resolve function implemented
tree structure is as we expect! printing function works too. :^)