5. Let $m$ and $n$ be integers greater than 1. If the sum of the fractions $\frac{m^{2}-1}{n+1}$ and $\frac{n^{2}-1}{m+1}$ is an integer, then, ( ).
(A) $\frac{m^{2}-1}{n+1}$ and $\frac{n^{2}-1}{m+1}$ are both integers
(B) $\frac{m^{2}-1}{n+1}$ is an integer, $\frac{n^{2}-1}{m+1}$ is not an integer
(C) $\frac{m^{2}-1}{n+1}$ is not an integer, $\frac{n^{2}-1}{m+1}$ is an integer
(D) $\frac{m^{2}-1}{n+1}$ and $\frac{n^{2}-1}{m+1}$ are not integers
5. (A).

Let $x=\frac{m^{2}-1}{n-1}, b=\frac{n^{2}-1}{m+1}$, then $ab=(m-1)(n-1)$ is an integer. Also, $a+b$ is an integer, so $a, b$ are the two roots of some integer-coefficient quadratic equation $x^{2}+p x+q=0$. Since $a, b$ are both rational numbers, the discriminant $\Delta=p^{2}-4 q$ of the equation is a perfect square. Solving the equation, we get $a, b=\frac{-p \pm \sqrt{p^{2}-4 q}}{2}$. Since $p^{2}-4 q$ has the same parity as $p$, the numerator of the root expression is even, hence $a, b$ are both integers.