The longest side of a triangle is 8 less than 3 times the longest side of a similar triangle. If the shortest sides of the triangles are 15 and 6, respectively, then what are the lengths of the longest side of each triangle?