A girl passed the exam thanks to a teacher's bold move