equals and hashCode should be overridden in pairs