The longest side of a triangle is 5 inches longer than the shortest side. The medium side is 2 inches longer than the shortest side. If the perimeter of the triangle is 22 inches, what are the lengths of the three sides?