N51 (43-3, Romania) Find all pairs of positive integers $m, n \geqslant 3$, such that there exist infinitely many positive integers $a$, for which
$$
\frac{a^{m}+a-1}{a^{n}+a^{2}-1}
$$

is an integer.
Lemma: Let $f(x)$ and $g(x)$ be two polynomials with rational coefficients, and $g(x) \neq 0$. If there exist infinitely many positive integers $a$ such that $\frac{f(a)}{g(a)}$ is an integer, then $f(x)$ is divisible by $g(x)$.

Proof: Let $f(x) = q(x) g(x) + r(x)$, where $q(x)$ and $r(x)$ are polynomials with rational coefficients, and the degree of $r(x)$ is less than the degree of $g(x)$. Let $d$ be the least common multiple of the denominators of the coefficients of $q(x)$. For any integer $a$, $d \cdot q(a)$ is an integer. Thus, if
$$
\frac{f(a)}{g(a)} = q(a) + \frac{r(a)}{g(a)}
$$
is an integer, then $d \cdot \frac{r(a)}{g(a)}$ is also an integer. Since
$$
\lim _{u \rightarrow \infty} d \cdot \frac{r(a)}{g(a)} = 0,
$$
there exists $A$ such that for any $a > A$, $g(a) \neq 0$ and
$$
\left|d \cdot \frac{r(a)}{g(a)}\right| < 1.
$$
If $a > A$ and $d \cdot \frac{r(a)}{g(a)} \in \mathbb{Z}$, then
$$
r(a) = 0.
$$
Therefore, if there are infinitely many positive integers $a$ such that $\frac{f(a)}{g(a)} \in \mathbb{Z}$, there must be infinitely many positive integers $a$ greater than $A$, and thus there are infinitely many positive integers $a$ such that $r(a) = 0$. This implies $r = 0$, i.e., $g \mid f$, and the lemma is proved.

Now, let's prove the original problem.
First, it is easy to verify that
$$
\frac{a^{5} + a - 1}{a^{3} + a^{2} - 1} = a^{2} - a + 1.
$$
When $a$ is an integer, this is an integer.
Next, we prove that $(m, n) = (5, 3)$ is the only solution.
By the lemma, we have
$$
\left(x^{n} + x^{2} - 1\right) \mid \left(x^{m} + x - 1\right),
$$
which implies $n \leq m$, and
$$
\left(x^{n} + x^{2} - 1\right) \mid \left[(x + 1)\left(x^{m} + x - 1\right) - \left(x^{n} + x^{2} - 1\right)\right] \triangleq F(x),
$$
then
$$
\begin{aligned}
F(x) & = x^{m+1} + x^{m} - x^{n} \\
& = x^{n}\left(x^{m-n+1} + x^{m-n} - 1\right),
\end{aligned}
$$
so
$$
\left(x^{n} + x^{2} - 1\right) \mid \left(x^{m-n+1} + x^{m-n} - 1\right).
$$
This implies $n \leq m - n + 1$ and $2 \leq n - 1 \leq m - n$. Since
$$
\begin{array}{c}
0^{n} + 0^{2} - 1 = -1, \\
1^{n} + 1^{2} - 1 = 1,
\end{array}
$$
there exists $\alpha \in (0, 1)$ such that $\alpha^{n} + \alpha^{2} - 1 = 0$. Given $n \leq m - n + 1$ and $2 \leq m - n$, we have
$$
\alpha^{n} \geq \alpha^{m-n+1}, \alpha^{2} \geq \alpha^{m-n},
$$
so
$$
0 \geq \alpha^{m-n+1} + \alpha^{m-n} - 1.
$$
The equality must hold because any root of $x^{n} + x^{2} - 1 = 0$ must also be a root of $x^{m-n+1} + x^{m-n} - 1 = 0$.
Thus, $n = m - n + 1$ and $2 = m - n$.
This gives $m = 5$ and $n = 3$, which completes the proof.