Sally bought shirts and pants for school. She bought a total of 8 items. Each pair of pants cost $28, and each shirt cost $12. She spent a total of $144. How many pairs of pants did Sally buy? How many shirts did she buy?