A textbook store sold a combined total of 332 history and chemistry textbooks in a week. The number of chemistry textbooks sold was 84 less than the number of history textbooks sold. How many textbooks of each type were sold?