I know I could do this with loops (as a matter of fact, I currently am, but I am trying to learn / imporve my Linq skills and i also hope it will provide a more efficent sol
This more or less Spender's solution, but this works.
In C#
var dict = lstTeachers.Zip(lstStudentsSex, (teacher, sex) => new { teacher, sex })
.Zip(lstStudentName, (x, student) => new { x.teacher, x.sex, student })
.GroupBy(x => x.teacher)
.ToDictionary(g => g.Key, g => g.GroupBy(x => x.sex)
.ToDictionary(p => p.Key, p => p.Select(x => x.student)));