@Override
  public int compareTo(Object o) {
    if (o instanceof IntIntPair) {
      IntIntPair llp = (IntIntPair)o;
      int cmp = first - llp.first;
      return cmp == 0 ? (second - llp.second) : cmp;
    }
    return 0;
  }