A rectangle and a triangle have equal areas. The length and width of the rectangle are 24 cm and 8 cm respectively. If the base of the triangle is 16 cm, what is the height of the triangle?