A chef got 8 bags of onions. The red onions came in bags of 2 and the yellow onions came in bags of 6. If the chef got a total of 28 onions, how many bags of each type of onion did he get?