3. 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.
3. Suppose $(m, n)$ is the solution, it is clear that $n\beta, \beta=0.618 \cdots$ is the positive root of $h(x)=x^{2}+x-1$. Since $f(x)$ is monotonically increasing in $(0,1)$, and
$$
f(\beta)<h(\beta)=0=f(\alpha) .
$$

On the other hand, if $m \geqslant 2 n$, then
$$
1-\alpha=\alpha^{m} \leqslant\left(\alpha^{n}\right)^{2}=\left(1-\alpha^{2}\right)^{2} \text {. }
$$

Thus, $\alpha(\alpha-1)\left(\alpha^{2}+\alpha-1\right) \geqslant 0$, which implies $\alpha \leqslant \beta$. This is a contradiction.
(4) For $m<2 n$, there is a unique solution $(m, n)=(5,3)$.

Assume there is a solution, consider $a=2$, and let
$$
d=g(2)=2^{n}+3 \text {. }
$$

From (1) we get
$$
\begin{array}{l}
-2^{m} \equiv 1(\bmod d) . \\
\text { Let } m=n+k, 1 \leqslant k<n \\
-2^{m} \equiv\left(d-2^{n}\right) 2^{k} \equiv 3 \times 2^{k}(\bmod d) .
\end{array}
$$

This indicates that when $1 \leqslant k \leqslant n-2$, $-2^{m} \neq 1(\bmod d)$.
When $k=n-1$, i.e., $m=2 n-1$, the smallest positive remainder of $-2^{m}$ modulo $d$ is $3 \times 2^{n-1}-d=2^{n-1}-3$, which is only 1 when $n=3$. Therefore, $m=5$.

Finally, $a^{3}+a-1=\left(a^{3}+a^{2}-1\right)\left(a^{2}-a+1\right)$, indicating that $(m, n)=(5,3)$ is a solution.
Hence, $(m, n)=(5,3)$ is the unique solution.