Code for cutting trees