pre in traversal of trees