Just one question:
Given the sample data you have provided, what do you expect the output to look like?
"Best possible combination" is an unclear requirement. 😉
Draw us a picture, and we can code it.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills