Circle of Debt

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2351 [PDF](https://uva.onlinejudge.org/external/113/p11366.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11366/3d5e120f2750a83b3cf4b5ad385258a649d4e606.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11366/34bba54177052e0bddaa81922611d2b6eebb9249.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11366/12821293dc35fd17649e4fc68049540bee21134e.png)

输入输出样例

输入样例 #1

3
10 0 0
0 1 0 0 0 0
0 0 0 3 0 10
0 0 3 0 0 0
-10 -10 -10
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
-10 10 10
3 0 0 0 2 0
0 2 0 0 0 1
0 0 1 1 0 3

输出样例 #1

5
0
impossible