public class Name implements Comparable {
  private String first, last;
  public Name(String first, String last) {
    this.first = first;
    this.last = last;
  }
  public String getFirst() { return first; }
  public String getLast() { return last; }  
  public String toString() { return first+" "+last; }
  public int hashCode() { return first.length()+last.length(); }
  public boolean equals(Object o) {
    Name other = (Name)o;
    return other.first.equals(first) && other.last.equals(last);
  }  
  public int compareTo(Object o) {    
    Name other = (Name)o;
    int c = last.compareTo(other.getLast());
    if (c != 0)
      return c;
    return first.compareTo(other.getFirst());
  }    
}
class ID implements Comparable
{
  private int i;
  public ID(int i)
  {
    this.i=i;
  }
  public int hashCode() { return i; }
  public boolean equals(Object o) {
    ID other = (ID)o;
    return i == other.i;
  }
  public int compareTo(Object o) {
    ID other = (ID)o;
    return i - other.i;
  }
  public String toString() { return String.valueOf(i); }
}

