generate tree