Brute force input based small tree is done