#K74352. Pythagorean Triple Checker
Pythagorean Triple Checker
Pythagorean Triple Checker
You are given several sets of three integers. For each set, determine whether the three integers can form a Pythagorean triple. A triple (a, b, c) is a Pythagorean triple if, after sorting the numbers into non-decreasing order, they satisfy the condition \(a^2 + b^2 = c^2\). The input terminates when a line with three zeros ("0 0 0") is encountered; do not process this terminating line.
For example, the triple (3, 4, 5) after sorting remains (3, 4, 5) and since \(3^2 + 4^2 = 9 + 16 = 25 = 5^2\), it is a valid Pythagorean triple.
inputFormat
The input consists of several lines. Each line contains three space-separated integers. The input terminates when a line containing exactly "0 0 0" is read. Do not process the terminating line.
outputFormat
For each triple (excluding the terminating triple), output a single line containing either "VALID" if the numbers form a Pythagorean triple (after sorting in non-decreasing order), or "INVALID" otherwise.
## sample3 4 5
1 2 3
0 0 0
VALID
INVALID
</p>