In an exam, there are 4 multiple-choice questions, each with 3 possible answers. A group of students takes the exam, and it is found that for any 3 students, there is at least 1 question for which their answers are all different. What is the maximum number of students that could have taken the exam?