{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"A word ring is a sequence of words where the last two letters of each word are the same as the first two letters of the next word (and the last two letters of the last word are the same as the first two letters of the first word). For example, the following sequence is a word ring: \r\u003cbr\u003e\r\u003cbr\u003eintercommunicational\r\u003cbr\u003ealkylbenzenesulfonate \r\u003cbr\u003etetraiodophenolphthalein\r\u003cbr\u003e\r\u003cbr\u003eYour task is to write a program that, given a list of words, finds a word ring. You have to make the word ring as impressive as possible: the average length of the words in the ring has to be as large as possible. In the above example, the average length is (20 + 21 + 24)/3 ≈ 21.6666 , which makes it somewhat impressive. Note that each word can be used at most once in the ring, and the ring can consist of a single word. \r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains several blocks of test cases. Each case begins with a line containing a single integer 1 ≤ n ≤ 100000 , the number of possible words that can be used. The next n lines contain these words. The words contain only the characters `a\u0027-`z\u0027 and the length of each word is at most 1000. \r\u003cbr\u003e\r\u003cbr\u003eThe input is terminated by a block with n \u003d 0 . \r\u003cbr\u003e\r\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case in the input, you have to output a single number on a separate line: the maximum average length of a ring composed from (a subset of) the words given in the input. The average length should be presented as a real number with two digits of precision. If it is not possible to compose a ring from these words, then output `No solution.\u0027 (without quotes). To avoid rounding problems, we accept solutions with a maximum of ±0.01 error. "}},{"title":"Sample","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\r\nintercommunicational\r\nalkylbenzenesulfonate\r\ntetraiodophenolphthalein\r\n0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e21.66\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"Huge input file, \u0027scanf\u0027 recommended to avoid TLE.\r\u003cbr\u003e"}}]}