There are two primary teachers. They can stand in a row in P(2, 2) = 2! = 2 × 1 ways = 2 ways ∴ Two middle teachers. They can stand in a row in P(2, 2) = 2! = 2 × 1 = 2 ways There are two secondary teachers. They can stand in a row in P(2, 2) = 2 × 1 = 2 ways These three sets can be arranged in themselves in = 3! = 3 × 2 × 1 = 6 ways Hence, the required number of ways = 2 × 2 × 2 × 6 = 48