Tree manipulation with Kotlin language