Generate a tree