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: Wrong Answer)

import java.util.Scanner;
class Main{

	 static int readNumber1(){    
	        
	        byte b[] = new byte[100];    

	        try{
	             System.in.read(b);
	             return Integer.parseInt((new String(b)).trim());
	        }catch(Exception e){
	             return 0;
	        }
	    }
	public static void main(String[] a) {
		Scanner keyboad=new Scanner(System.in);
		int   kai = readNumber1();
		int i[]=new int[1000];
		int j[]=new int[1000];
		int l[]=new int[1000];
		
		
		
		for(int k=0;k<kai;k++){
		String str1 =keyboad.nextLine();
		String[] bun = str1.split(" ");
		
		i[k]= Integer.valueOf(bun[0]).intValue();
		j[k]= Integer.valueOf(bun[1]).intValue();
		l[k]= Integer.valueOf(bun[2]).intValue();
		}
		
		int mob[][]=new int[kai][3];
		int kau[][]=new int [kai][3];
		int max[][]=new int[kai][3];
		
			for(int b=0;b<kai;b++){
			for(int s=0;s<3;s++){
				if (i[b] > j[b]) {
					max[b][s] = i[b];
					mob[b][s] = i[b];
					kau[b][s]=1;
				} else {
					max[b][s] = j[b];
					mob[b][s] = j[b];
					kau[b][s]=2;
				}
				
				if (l[b] > max[b][s]) {
					max[b][s] = l[b];
					mob[b][s] = l[b];
					kau[b][s]=3;
				}
			if(kau[b][s]==1)i[b]=-1;
			else if(kau[b][s]==2)j[b]=-1;
			else if(kau[b][s]==3)l[b]=-1;
			}
	
			}
			for(int z=0;z<kai;z++){
				if(max[z][0]*max[z][0]==max[z][1]*max[z][1]+max[z][2]*max[z][2]){
					System.out.println("YES");
				}else System.out.println("NO");
			}
		}
		
	}