Uncle Ian spent $59 at a book store. He bought science fiction and mystery novels. The science fiction novels cost $7 apiece and the mystery novels cost $9 apiece. If uncle Ian bought 7 novels, how many of each type did he buy?