A farmer was on his tractor and drove by some chickens and pigs in his field. He counted 30 heads and 84 legs. Determine how many chickens and how many pigs.