At the beginning of each year the sorting hat is placed on each student in their first year. It divides them into the houses Gryffindor, Ravenclaw, Hufflepuff, and Slytherin (if that's how you spell...
In the first to the sixth books, they are as follows: Gryffindor: Minverva Mcgonagall, Transfiguration mistress Ravenclaw: Fillius Flitwick, Charms master Hufflepuff: Pomona Sprout, Herbology...