import javax.swing.*; 
import java.util.*;
import java.awt.*;
import java.awt.event.*;

class One extends JFrame {
  One(int circles) {
    this.setVisible(true); 
    this.setSize(500, 400); 
    this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); 
    this.getContentPane().add( new Two(circles) );
  } 
  public static void main(String[] args) {
    JFrame f = new One(Integer.parseInt(args[0])); 
  } 
}

class Two extends JComponent implements MouseMotionListener {

  Circle current; 

  public void mouseMoved(MouseEvent e) { 
    int x, y; 
    x = e.getX(); 
    y = e.getY(); 
    this.current = this.circles.get(0); 

    this.current.moveTo(x, y); 
    this.repaint(); 

    System.out.println( "(" + x + ", " + y + ")" ); 

    System.out.println( this.current ); 

  } 
  public void mouseDragged(MouseEvent e) { } 

  ArrayList<Circle> circles; 

  Two(int circles) {

    this.addMouseMotionListener( this ); 

    this.circles = new ArrayList<Circle>(); 
    for (int i = 0; i < circles; i = i + 1) {
      this.circles.add( new Circle( 

new Point( (int) (Math.random() * 400 + 100), 
           (int) (Math.random() * 300 + 100) 
         ), 
(int) (Math.random() * 40 + 20), 
new Color( (int) (Math.random() * 255) , 
           (int) (Math.random() * 255) , 
           (int) (Math.random() * 255)
         )

                                  ) 
                      ); 
    } 
  }
  public void paintComponent(Graphics g) {
    for (Circle c : this.circles) 
      c.draw(g); 
  } 
}

class Circle {
  Point center;
  int radius;
  Color color; 
  Circle(Point a, int r, Color c) {
    this.center = a; 
    this.radius = r; 
    this.color = c; 
  } 
  void draw(Graphics g) {

    g.setColor(this.color); 
    g.fillOval(this.center.x - this.radius, 
               this.center.y - this.radius, 
               2 * this.radius, 2 * this.radius); 
    g.setColor(Color.BLACK); 
    g.drawOval(this.center.x - this.radius, 
               this.center.y - this.radius, 
               2 * this.radius, 2 * this.radius); 
  }
  void moveTo(int x, int y) {
    this.center = new Point(x, y); 
  } 
  public String toString() {
    return "Circle at " + this.center + " with radius " + this.radius; 
  }
}

class Point {
  int x, y;
  Point(int x, int y) {
    this.x = x; 
    this.y = y; 
  } 
  public String toString() {
    return "(" + this.x + ", " + this.y + ")"; 
  } 
}