Telephone Network
题目描述
[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=244&page=show_problem&problem=3419
[PDF](https://uva.onlinejudge.org/external/122/p12267.pdf)
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12267/6be994e0f6ebfc4195bcea75d3a6c5bfc827ad22.png)
输入输出格式
输入格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12267/c9421a8ecfc28bb11f9195d28a8c07d28ee5424d.png)
输出格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12267/f87f75ac2d11bad0a8475e185b3ff50aa72fe17c.png)
输入输出样例
输入样例 #1
2
1 1
0 1
3 5
0 3
1 4
2 5
3 6
4 7
输出样例 #1
0
3 0 1 2 4