Solves various types of congruence relationships