
import java.io.*;
import java.util.StringTokenizer;
import java.math.*;
/**
 *@author      Jeff
 *@created     January 21, 2003
 *@filename    prog1.java
 *@purpose     This is a class to determine whether three points (entered in (x
 *      y) format are the vertices of a right triangle.
 */
public class prog1 {

	// The main program for the prog1 class
	/**
	 *  The main program for the prog1 class
	 *
	 *@param  args             The command line arguments
	 *@exception  IOException  Description of the Exception
	 */
	public static void main(String[] args) throws IOException {
		int x1 = 0;
		int y1 = 0;
		int x2 = 0;
		int y2 = 0;
		int x3 = 0;
		int y3 = 0;
		int temp = 0;
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		System.out.println("\tThis program will determine if you have a right triangle.");
		System.out.print("Please enter the coordinates of point 1, separated by a space: ");
		String point1 = input.readLine();
		System.out.print("Please enter the coordinates of point 2, separated by a space: ");
		String point2 = input.readLine();
		System.out.print("Please enter the coordinates of point 3, separated by a space: ");
		String point3 = input.readLine();
		StringTokenizer st1 = new StringTokenizer(point1);
		if (st1.hasMoreTokens()) {
			String x = st1.nextToken();
			x1 = Integer.parseInt(x);
			String y = st1.nextToken();
			y1 = Integer.parseInt(y);
		}
		StringTokenizer st2 = new StringTokenizer(point2);
		if (st2.hasMoreTokens()) {
			String x = st2.nextToken();
			x2 = Integer.parseInt(x);
			String y = st2.nextToken();
			y2 = Integer.parseInt(y);
		}
		StringTokenizer st3 = new StringTokenizer(point3);
		if (st3.hasMoreTokens()) {
			String x = st3.nextToken();
			x3 = Integer.parseInt(x);
			String y = st3.nextToken();
			y3 = Integer.parseInt(y);
		}
		int aSquared = ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
		int bSquared = ((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
		int cSquared = ((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
//System.out.println(aSquared+" "+bSquared+" "+cSquared); //Debugging Statement
		if ((aSquared >= cSquared) && (aSquared >= bSquared)) {
			temp = cSquared;
			cSquared = aSquared;
			aSquared = temp;
		}
		if ((bSquared >= aSquared) && (bSquared >= cSquared)) {
			temp = cSquared;
			cSquared = bSquared;
			bSquared = temp;
		}
//System.out.println(aSquared+" "+bSquared+" "+cSquared); //Debugging Statement.
		if ((aSquared + bSquared) == cSquared) {
			System.out.println("Yes, they form a right angled triangle.");
		} else {
			System.out.println("No, they do not form a right angled triangle");
		}

	}

}

