by the way viv, u can't proceed in such a way. each master can choose his monkey in n ways. first can choose in n ways. second can also choose in n ways because he also have n monkeys to choose from.That will satisfy the cond. AND SO ON..... therefore, n*n*n*n*n.................m times=n^m