Compare fractions with the same numerator or denominator