Suppose triangles P, Q, and R have sides with the given measurements.

triangle P: 12, 24, and 30
triangle Q: 9, 40, and 41
triangle R: 5, 18, and 21
Which triangle is a right triangle? Explain your reasoning.