{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eConsider n given non-empty strings denoted by s1 , s2 , · · · , sn . Now for each of them, you need to select a corresponding suffix, denoted by suf1, suf2, · · · , sufn. For each string si, the suffix sufi is a non-empty substring whose right endpoint is the endpoint of the entire string. For instance, all suffixes of the string “jiangsu” are “u”, “su”, “gsu”, “ngsu”, “angsu”, “iangsu” and itself.\u003c/p\u003e\n\u003cp\u003eAll selected suffixes could assemble into a long string T \u003d $suf_1$ + $suf_2$ + · · · + $suf_n$ . Here plus signs indicate additions of strings placing the latter at the tail of the former. Your selections of suffixes would determine the lexicographical order of T . Now, your mission is to find the one with minimum lexicographical order.\u003c/p\u003e\n\u003cp\u003eHere is a hint about lexicographical order. To compare strings of different lengths, the shorter string is usually padded at the end with enough “blanks” which is a special symbol that is treated as smaller than every letters.\u003c/p\u003e\n\u003ch2 id\u003d\"input\"\u003eInput\u003c/h2\u003e\n\u003cp\u003eThe first line of input contains an integer T which is the total number of test cases. For each case, the first line contains an positive integer n. Each of the following n lines contains a string entirely in lowercase, corresponding to $s_1$ , $s_2$ , · · · , $s_n$ . The summation of lengths of all strings in input is smaller or equal to 500000.\u003c/p\u003e\n\u003ch2 id\u003d\"output\"\u003eOutput\u003c/h2\u003e\n\u003cp\u003eFor each test case, output the string T with minimum lexicographical order.\u003c/p\u003e\n"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n3\nbbb\naaa\nccc\n3\naba\naab\nbab\n2\nabababbaabbababba\nabbabbabbbababbab\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003ebaaac\naaabab\naab\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}