Let us denote two boys and two girls in room P as B1, B2 and G1, G2, respectively.
Let us denote one boy and three girls in room Q as B3 and G3, G4, G5, respectively.
Accordingly, the required sample space is given by S = {(P, B1), (P, B2), (P, G1), (P, G2) (Q, B3), (Q, G3), (Q, G4),
(Q, G5)}.