import java.util.Arrays;
public class PointsInOrder {
   public static final int NUMPOINTS = 10;
	public static final int RANGE = 20;
	public static void main(String[] args) {
      OrderedPoint[] points = new OrderedPoint[NUMPOINTS];
		// create random points with x,y in [0,19]
	   for (int i=0; i<NUMPOINTS; i++)
		{
		   points[i] = new OrderedPoint( (int) (Math.random()*RANGE),
			   (int) (Math.random()*RANGE));
		}
		// arrange in order of increasing distance from origin
		Arrays.sort(points);
		// print them out in order
		for (int i=0; i<NUMPOINTS; i++) 
		{
		   System.out.println(points[i]);
		}
	}
}