BerOilGasDiamondBank has branches in
n cities, at that
n is an even number. The bank management wants to publish a calendar with the names of all those cities written in two columns: the calendar should consist of exactly
n/2 lines of strictly equal length, each of which contains exactly two names and exactly one separator character between them. The name of every city should be used in the calendar exactly once. For historical reasons the symbol
d is used as the separator of words in the calendar.
The BerOilGasDiamondBank management wants to show that all its branches are equally important to it, that's why the order of their appearance in the calendar should be following: if we "glue"(concatinate) all the
n/2 calendar lines (from top to bottom) to make a single line, then the lexicographically minimal line is obtained. No separator character will be used to separate calendar lines. For example, if the lines are "bertown!berville", "newberville!bera", then the resulting line is "bertown!bervillenewberville!bera". In some sense one has to find the lexicographically minimal calendar, where the comparison of calendars happens line by line.
Help BerOilGasDiamondBank and construct the required calendar.
BerOilGasDiamondBank在n个城市设有分行,n是偶数。银行管理层希望发布一个日历,将所有这些城市的名称写在两列中:日历应由 n / 2 行长度严格相等的行组成,每行都包含两个名称,它们之间只有一个分隔符。每个城市的名称应该在日历中使用一次。由于历史原因,符号 d 用作日历中单词的分隔符。
BerOilGasDiamondBank 管理层希望表明其所有分支机构对它同样重要,这就是为什么它们在日历中出现的顺序应该遵循:如果我们“粘合”(连接)所有 n / 2 个日历行(从上到下)形成一条线,那么获得字典顺序最小的行。不会使用分隔符来分隔日历行。例如,如果行是“bertown!berville”,“newberville!bera”,则生成的行是“bertown!bervillenewberville!bera”。从某种意义上说,人们必须找到字典顺序最小的日历,其中日历的比较逐行进行。
帮助BerOilGasDiamondBank并构建所需的日历。
Output
Print
n/2 lines of similar length which are the required calendar. Every line should contain exactly two words and exactly one separator between them. If there are several solutions, print the lexicographically minimal one. The lexicographical comparison of lines is realized by the "
<" operator in the modern programming languages.