Problem:
Is it a Right Triangle?

Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.

Input

Input consists of several data sets. In the first line, the number of data set, N is given. Then, N lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.

Constraints

1 ≤ length of the side ≤ 1,000

N ≤ 1,000

Output

For each data set, print "YES" or "NO".

Sample Input

3
4 3 5
4 3 6
8 8 8

Output for the Sample Input

YES
NO
NO

Solution in C# (judge verdict: Accepted)

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string sCount =Console.ReadLine();
            int ncount = int.Parse(sCount);
            for (int i = 0; i < ncount; i++)
            {
                string input = Console.ReadLine();
                string[] data = input.Split();
                int data1 = int.Parse(data[0]);
                int data2 = int.Parse(data[1]);
                int data3 = int.Parse(data[2]);
                
                int ans = 0;
                if (data1 * data1 + data2 * data2 == data3 * data3)
                    ans++;
                if (data1 * data1 + data3 * data3 == data2 * data2)
                    ans++;
                if (data3 * data3 + data2 * data2 == data1 * data1)
                    ans++;

                if (ans == 0)
                    Console.WriteLine("NO");
                else
                    Console.WriteLine("YES");
            }
            Console.ReadLine();
            //while (true)
            //{
            //    string a = Console.ReadLine();
            //        if (a == null)
            //            break;
            //    string[] aa = a.Split();
            //    int data1 = int.Parse(aa[0]);
            //    int data2 = int.Parse(aa[1]);

            //    int data0 = data1 + data2;

            //    int count = 1;
            //    while (true)
            //    {

            //        data0 /= 10;
            //        if (data0 != 0)
            //            count++;
            //        else
            //            break;
            //    }
            //    Console.WriteLine(count);
            //}
            //Console.ReadLine();
            //int[] ans = { 0, 0, 0 };
            //for (int i = 0; i < 10; i++)
            //{
            //    string a = Console.ReadLine();
            //    int aa = int.Parse(a);

            //    if (ans[0] < aa)
            //    {
            //        ans[2] = ans[1];
            //        ans[1] = ans[0];
            //        ans[0] = aa;
            //    }
            //    else if (ans[1] < aa)
            //    {
            //        ans[2] = ans[1];
            //        ans[1] = aa;
            //    }
            //    else if (ans[2] < aa)
            //    {
            //        ans[2] = aa;
            //    }
            //}

            //Console.WriteLine(ans[0]);
            //Console.WriteLine(ans[1]);
            //Console.WriteLine(ans[2]);
            //Console.ReadLine();

            //    for (int i = 1; i <= 9; i++)
            //    {
            //        for (int ii = 1; ii <= 9; ii++)
            //        {
            //            string ans;
            //            ans = i+"x"+ii+"="+i*ii;
            //            Console.WriteLine(ans);

            //        }

            //    }
            //            Console.ReadLine();        }
        }
    }
}