format tree output