@Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!(obj instanceof Pair))
            return false;
        Pair p = (Pair) obj;
        return p.i == i && p.j == j;
    }