Can anyone explain approach to AMR16A "Tim and BSTs"?

I have read the question but was unable to figure out the approach. Can anyone explain?
Also, are there any editorials to previous year ICPC questions?

Link : https://www.codechef.com/problems/AMR16A

The editorials will be up sometime soon. Perhaps after prelims.