you give m set integer a_1 a_2 ldot a_m element set integer 1 n inclusivethere array positive integer a_1 a_2 ldot a_m b_1 b_2 ldot b_n in operation delete element j set A_i pay a_i b_j coin thatyou maybe operation set emptyafter edgecolore undirected graph consist n vertex for set a_i add edge x y color x y A_i x y some pair vertice connect edge edge different colorsyou cycle i_1 e_1 i_2 e_2 ldot i_k e_k i_1 e_j edge connect vertex i_j i_j1 graph rainbow edge different colorsfind minimum number coin pay graph rainbow cycle