(i) Ve Vídni byla kriminalistická, hudební a baletní škola. Cimrman učil v této škole.

First step: identify the common entity: škola.

Second step: který must take the gender and number of škola: fem. sg.

Third step: který must take the case from the second clause: škola in the second sentence is in the prepositional phrase "v této škole" thus locative.

Fourth step: Be sure to start the který-clause with the preposition "v"; který is part of the prepositional phrase and "v" cannot be left behind somewhere else back in the clause.