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 JAVA (judge verdict: Accepted)

import java.io.IOException;
import java.util.Scanner;

class Main {
    public static void main(String[] args) throws IOException {
    	 Scanner sc = new Scanner(System.in);
    	 sc.useDelimiter("\\n");//
    	 int setOfData = 0;// データセット数
    	 
         while(sc.hasNext()) {
        	 String str = sc.nextLine();
        	 String[] splitted = str.split(" ");// 空白で文字列を分割する
        	 int length = splitted.length;// 要素の数
        	 if(length == 1) { // データセット数
        		 setOfData = numOfSet(splitted); // データセット数をセットする
        	 } else if(length == 3) { // 三角形の三辺
        		 if(isRightAngle(splitted)) {
            		 System.out.println("YES");
            	 } else {
            		 System.out.println("NO");
            	 }        		 
        	 } else { // それ以外（現状は無視）
        		 
        	 }
         }
    	if (sc.ioException() != null) {
    	    throw sc.ioException();
    	}
    	
    }
    /** データセット数を取得するメソッド */
    public static int numOfSet(String[] string) {
    	return Integer.valueOf(string[0]);
    }
    
    /** 直角三角形かどうかを判断するメソッド */
    public static Boolean isRightAngle(String[] string) {
    	int x = Integer.valueOf(string[0]);
    	int y = Integer.valueOf(string[1]);
    	int z = Integer.valueOf(string[2]);
    	x = x*x;
    	y = y*y;
    	z = z*z;
    	
    	if(x == y+z || y == x+z || z == x+y) {
    		return true;
    	} else {
    		return false;
    	}
    }
}