tree constructor