Eigenvalues of a triangular matrix
Work in \(\mathbb F_p\), where \(p=1\,000\,000\,007\). You are given an upper
triangular matrix (A\). Its characteristic polynomial is
\[
\det(xI-A)=\prod_{i=0}^{n-1}(x-A_{i,i}),
\]
so its eigenvalues, counted with algebraic multiplicity, are exactly its
diagonal entries.
Input
The first line contains (n). The next (n) lines contain an upper triangular
(n\times n) matrix (A).
Output
Print the (n) eigenvalues, counted with multiplicity, in nondecreasing order.
All values are compared modulo (p).
Constraints
- \(1\le n\le 200\)
- Every matrix entry is an integer in \([0,p)\)