(7) There are 6 students consulting about their grades. The teacher says: A is not the best among the 6, B is not the worst among the 6, and the grades of the 6 students are all different. How many different possible rankings of their grades are there? ( ).
(A) 120 kinds
(B) 216 kinds
(C) 384 kinds
(D) 504 kinds
(7) D Hint: Solution 1 Let $A$ be the set of all possible rankings where A ranks first, and $B$ be the set of all possible rankings where B ranks last. Then $|A| = |B| = 5!, |A \cap B| = 4!$.
The number of all possible rankings where A ranks first or B ranks last is
$$
|A \cup B| = |A| + |B| - |A \cap B| = 216 \text{. }
$$

According to the teacher, the number of all possible rankings for the 6 students is $6! - 216 = 504$.
Solution 2 Consider all possible rankings where B is not last, and A is not first.
(1) The number of all possible rankings where A is last is $\mathrm{A}_{5}^{5} = 120$;
(2) The number of all possible rankings where A is neither first nor last is $\mathrm{C}_{4}^{1} \cdot$
$$
\mathrm{C}_{4}^{1} \cdot \mathrm{A}_{4}^{4} = 384 \text{. }
$$

Therefore, the number of all possible rankings where A is not first and B is not last is $120 + 384 = 504$.