In a scalene triangle, the longest side is 5 less than triple the short side, the medium side is two more than the short side, and the perimeter is 17. What are the three side lengths?