Let me write the polynomial in the usual order (decreasing powers), just for a matter of habit:

As for the numeric part, we can factor a 3, because it's the largest common divisor of 6, 9 and 18:

For the variable part, we can factor a
, because it's the power with the smaller exponent appearing in all terms:
