UVA10265 Toroidal Chess Queens' Problem

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=14&page=show_problem&problem=1206 [PDF](https://uva.onlinejudge.org/external/102/p10265.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10265/12cf44afb66c2f9f456efd1380cbf03a61c53f5b.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10265/07d4a97d4f39f64232d6f7f4e2db29f4b1116b12.png)