Kent is cutting a long tree into pieces. He cut the trunk into 3 pieces. Then he cut each of those pieces into 3 smaller pieces. Finally he cut each of those smaller pieces into 3 still smaller pieces. ​How many pieces did they have then?