Enforced a<b<c and generalized the code