Compatibility Criterion for Two Congruences