Write history tree.