build tree from in_post and in_pre