A gym class has 12 students, 6 girls and 6 boys. The teacher has 4 jerseys in each of 3 colors to mark 3 teams for a soccer tournament. If the teacher wants at least one girl and at least one boy on each team, how many ways can he give out the jerseys? (Jerseys of the same color are indistinguishable.)