The school store sells Midville High T-shirts for $12 each and Midville High gym shorts for $8 a pair. One afternoon they sold a total of 41 T-shirts and pairs of shorts for a total of $416. How many T-shirts did they sell and how many pairs of shorts did they sell?