Rooks

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=18&page=show_problem&problem=1556 [PDF](https://uva.onlinejudge.org/external/106/p10615.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10615/47edafcb1d14f8b8083abd4db41b2ad2b1d3abd3.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10615/fcb13022a221491e87d6dd98337ae4ee91137ef1.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10615/43db1f9f7cbdb09961a483153fd2bd454ca50f63.png)

输入输出样例

输入样例 #1

2
2
*.
**
4
*.*.
*.*.
***.
..**

输出样例 #1

2
2 0
1 2
4
1 0 2 0
3 0 1 0
2 1 3 0
0 0 4 1