1. The number of students in the school is less than 5000.
2. When the students are divided equally into teams of 9, 10, 12, or 25, exactly 4 students are left out.
3. Since 4 is less than 9, 10, 12, and 25, it's also the remainder when divided by their least common multiple (LCM).
4. Therefore, the remainder when divided by LCM(9, 10, 12, 25) is 4.
5. LCM(9, 10, 12, 25) = 900, so we can express the number of students (N) as N = 900x + 4, where x is a positive integer.
6. Since N < 5000, we can consider values of x from 0 to 5.
7. However, N = 900x + 4 is a multiple of 11 only when x = 2, because 1800 + 4 = 1804 is a multiple of 11.
8. When x = 2, N = 900 * 2 + 4 = 1804.
9. We can divide these 1804 students into groups of 12, resulting in 150 groups (since 1804 = 12 * 150 + 4).
Hence, the maximum number of teams of 12 each that can be formed is 150.