very cool problem. here we have to consider the groups like individuals to choose from.
16 students, 4 groups (G1, G2, G3, G4) of 4 students each
we want to form N TEAMS such that each TEAM member is from a different group
we have to consider first of all how to pick 3 groups out of 4 without repetition
(G1, G2, G3, __)
(G1, G2, __, G4)
(G1, __, G3, G4)
(__, G2, G3, G4)
--> because we want than to pick from each of these one student to form a TEAM.
we can pick 3 groups out of 4 in 4C3 = 4 ways (as illustrated above)
let's say we picked the groups G1, G2 and G3 (the first arrangement)
each time we pick a group we imagine we are also randomly picking a student. how many ways we can pick a student in a group? in 4 possible ways. so given that we have to pick the first group (G1)(we can pick 4 students), the second group (G2)(so we can pick 4 students) and the third group (G3) (so we can pick 4 students) --> we have a total of 4^3 possible ways to pick a 3 students from 3 different group to form a TEAM (for the counting principle)
but we have 4 possible ways to pick 3 groups from 4 --> so we make the same reasoning for the other 3 possible arrangements--> we will have at the end
4*4^3 = 4^4 possible ways to create a TEAM that contains students from different groups.