classifying polynomials by degree and number of terms