In general
#color(white)("XXX")(x^2+(color(red)(a)+color(blue)(b))x+color(red)(a)*color(blue)(b))=(x+color(red)(a))(x+color(blue)(b))#
#8 = color(red)(2)+color(blue)(6)#
and
#12=color(red)(2)*color(blue)(6)#
So
#x^2+8x+12#
#color(white)("XXX")=(x^2+(color(red)(2)+color(blue)(6))x+color(red)(2)*color(blue)(6)#
#color(white)("XXX")=(x+color(red)(2))(x+color(blue)(6))#