Generating Fast

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=12&page=show_problem&problem=1039 [PDF](https://uva.onlinejudge.org/external/100/p10098.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10098/f90ae2e6e97ea26dff771e444046ad7a5afbfd41.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10098/0957311e3dd3d7af39f6eb9c8bd1e5fe9d887dd1.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10098/2eec7cf1f33dbaf3cccbe2fafc1d57c0b13a3a08.png)

输入输出样例

输入样例 #1

3
ab
abc
bca

输出样例 #1

ab
ba
abc
acb
bac
bca
cab
cba
abc
acb
bac
bca
cab
cba