if i write mn in prime factors

ex. 35 = 5*7

114=2*3*19

45=3*3*5 but if prime number are same i will write 45 in 45 =9*5

ex.135=27*5

180180=4*9*5*7*11*13

and then if i want to separate them in 2 groups such that (4*9 , 5*7*11*13) or (4*7*13 ,5*9*11)

i want to divide array in two group without condition

how can i know all of case about this and show all of them

i want to know only case of m

in my program i input 4,9,5,7,11,13 and then it will output like that

please,

thank you .