{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n \u003cp\u003eLittle Daniel loves to play with strings! He always finds different ways to have fun with strings! Knowing that, his friend Kinan decided to test his skills so he gave him a string \u003cstrong\u003eS\u003c/strong\u003e and asked him \u003cstrong\u003eQ\u003c/strong\u003e questions of the form:\u003c/p\u003e\n \u003cp\u003eIf all distinct substrings of string \u003cstrong\u003eS\u003c/strong\u003e were sorted lexicographically, which one will be the \u003cstrong\u003eK-th\u003c/strong\u003e smallest?\u003c/p\u003e\n \u003cp\u003eAfter knowing the huge number of questions Kinan will ask, Daniel figured out that he can\u0027t do this alone. Daniel, of course, knows your exceptional programming skills, so he asked you to write him a program which given \u003cstrong\u003eS\u003c/strong\u003e will answer Kinan\u0027s questions.\u003cbr\u003e\u003cstrong\u003e\u003cbr\u003e\n Example:\u003c/strong\u003e\u003c/p\u003e\n \u003cp\u003e\u003cstrong\u003eS\u003c/strong\u003e \u003d \"aaa\" (without quotes)\u003cbr\u003e\n substrings of S are \"a\", \"a\", \"a\", \"aa\", \"aa\", \"aaa\". The sorted list of distinct substrings will be: \"a\", \"aa\", \"aaa\".\u003c/p\u003e\n \u003ch3\u003eInput\u003c/h3\u003e\n \u003cp\u003eIn the first line there is Kinan\u0027s string \u003cstrong\u003eS\u003c/strong\u003e (with length no more than 90000 characters). It contains only small letters of English alphabet. The second line contains a single integer \u003cstrong\u003eQ\u003c/strong\u003e (\u003cstrong\u003eQ\u003c/strong\u003e \u0026lt;\u003d 500), the number of questions Daniel will be asked. In the next \u003cstrong\u003eQ\u003c/strong\u003e lines a single integer \u003cstrong\u003eK\u003c/strong\u003e is given (0 \u0026lt; \u003cstrong\u003eK\u003c/strong\u003e \u0026lt; 2^31).\u003c/p\u003e\n \u003ch3\u003eOutput\u003c/h3\u003e\n \u003cp\u003eOutput consists of \u003cstrong\u003eQ\u003c/strong\u003e lines, the \u003cstrong\u003ei-th \u003c/strong\u003econtains a string which is the answer to the \u003cstrong\u003ei-th\u003c/strong\u003e asked question.\u003c/p\u003e\n \u003ch3\u003eExample\u003c/h3\u003e\n \u003cpre\u003e\u003cstrong\u003eInput:\u003c/strong\u003e\u003cbr\u003eaaa\u003cbr\u003e2\u003cbr\u003e2\u003cbr\u003e3\u003cbr\u003e\u003cbr\u003e\u003cstrong\u003eOutput:\u003c/strong\u003e\r\naa\u003cbr\u003eaaa\u003c/pre\u003e\n \u003cp\u003e\u003cb\u003eEdited:\u003c/b\u003e Some input file contains garbage at the end. Do not process them.\u003c/p\u003e\n\u003c/div\u003e"}}]}