The sum of two numbers is 12. When one number is subtracted from three times the other, the result is 5. Find the numbers.