Restore tree by traversal