this is my first program but always i get NZEC 
this is the code :
public class Main{
public static String egypt(int x, int y ,int z){
if(x>0 && y>0 && z>0 && x<30000 && y<30000 && z<30000){
if(Math.pow(x,2)+Math.pow(y,2)==Math.pow(z,2)){
return "right";
}
else{
return "wrong";
}
}
else{
return "wrong";
}
}
public static void main (String[] args) throws java.lang.Exception{
java.io.BufferedReader sc = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
String r = sc.readLine();
while(!r.equals("0 0 0")){
int x = Integer.parseInt(r.substring(0,r.indexOf(" ")));
r = r.substring(r.indexOf(" ")+1);
int y = Integer.parseInt(r.substring(0,r.indexOf(" ")));
r = r.substring(r.indexOf(" ")+1);
int z = Integer.parseInt(r);
System.out.println (egypt(x,y,z));
r= sc.readLine();
}
}
}