This page is still under construction.

Parts of this page are still being built. What you see may change.

Right Triangle

Interview

Time limit1sMemory limit128 MB

Summary
Read triples of side lengths until 0 0 0, and print right if the squares of the two shorter sides sum to the square of the longest, else wrong.
Level

Easy2 of 10

Topics
Math, Implementation, Sorting, Geometry
Solved
No attempts yet

Problem

The ancient Egyptians knew that a triangle with side lengths 3, 4, and 5 is a right triangle. Given the lengths of the three sides of a triangle, decide whether it is a right triangle.

Input

The input consists of several test cases. Each test case is a line with three side lengths, each a positive integer less than 30,00030{,}000.

The input ends with a line containing 0 0 0, which is not a test case and must not be processed.

Output

For each test case, print right if the three sides form a right triangle, and wrong otherwise.

Examples3

  1. Example 1

    Input
    6 8 10
    25 52 60
    5 12 13
    0 0 0
    
    Expected output
    right
    wrong
    right
    
  2. Example 2

    Input
    3 4 5
    0 0 0
    
    Expected output
    right
    
  3. Example 3

    Input
    1 1 1
    0 0 0
    
    Expected output
    wrong