generate a tree for cdr and car functions