I need to group all second element values of sub-arrays by first element values of sub-arrays that are duplicate, but I can\'t find a solution. How can this be done?