crated naive algorithm to solve congruency system--before this commit