class Point {
	protected int x, y;
	
	public boolean equals(Object o) {
		if (!(o instanceof Point)) return false;
		Point other = (Point)o;
		return other.x == x && other.y == y;
	}
	
	public int hashCode() {
		return x * 31 + y;
	}
}

class ColoredPoint extends Point {
	protected int color;
	
	public boolean equals(Object o) {
		if (!(o instanceof ColoredPoint)) return false;
		ColoredPoint cp = (ColoredPoint) o;
		return super.equals(o) && cp.color == color;
	}
	
	public int hashCode() {
		return super.hashCode() * 31 + color;
	}
}

class BuggyInit {
	public static void main (String[] args) {
		Point center = new Point();
		ColoredPoint white = new ColoredPoint();
		ColoredPoint red = new ColoredPoint();
		red.color = 0xff0000;
		
		System.out.println("center == white ? " + center.equals(white));
		System.out.println("center == red ? " + center.equals(red));
		System.out.println("Well, center == white, center == red, so, white == red, isn't it ? " + white.equals(red));
		System.out.println("Hm... center == white, so white == center, I'm sure.  " + white.equals(center));
	}
}