Fairness constraints can help exact inference in structured prediction