public class cartesian
{
String name;
double xi,xj,xk;
//constructor method
public cartesian(String namei,double xii,double xji,double xki)
{name=namei;
 xi=xii;
 xj=xji;
 xk=xki;
}

public cartesian(cartesian ai)
{name=ai.name;
 xi=ai.xi;
 xj=ai.xj;
 xk=ai.xk;
}
public String toString()
{String s="point "+name+" = ["+xi+","+xj+","+xk+"]";
 return s;
}
public double distance(cartesian a1)
{double dist=Math.sqrt((a1.xi-xi)*(a1.xi-xi)+(a1.xj-xj)*(a1.xj-xj)+(a1.xk-xk)*(a1.xk-xk));
 return dist;
}

public static double distance(cartesian a0,cartesian a1)
{double dist=Math.sqrt((a1.xi-a0.xi)*(a1.xi-a0.xi)+(a1.xj-a0.xj)*(a1.xj-a0.xj)+(a1.xk-a0.xk)*(a1.xk-a0.xk));
 return dist;
}
}