I want to find occurrence of each set of Cartesian product like
A = [1,2]
B = [2,1]
then
A * B = [(1,2),(1,1),(2,2),(2,1)]
then I want to find occurrence of each set like
(1,2)
occurs 2 times [(1,2), (2,1)]
(1,1)
occurs 1 time (1,1)
and so on....