Let us denote 2 boys and 2 girls in room X as B1, B2 and G1, G2 respectively. Let us denote 1 boy and 3 girls in room Y as B3, and G3, G4, G5 respectively.

Accordingly, the required sample space is given by

S = {XB1, XB2, XG1, XG2, YB3, YG3, YG4, YG5}