The middle side of a triangle is 3 cm longer than the shortest side, and the longest side is 4 cm longer than the middle side. Find the lengths of all three sides if the perimeter is 97 cm.