{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"\u003cp\u003eJohnny has figured out that there are some numbers which have an interesting property: they are the same when read from left to right, and from right to left. For example, 5115 and 929 are such numbers, while 31 and 125 are not. Johnny calls such numbers palindromic numbers.\u003c/p\u003e\n\u003cp\u003eAfter a while, Johnny has realized that his definition of palindromic numbers is not really precise. Whether a number is palindromic or not depends on the base in which the number is written. For example, 21 is not palindromic in base 10 but it is palindromic in base 2 (because 21 \u003d 10101\u003csub\u003e2\u003c/sub\u003e).\u003c/p\u003e\n\u003cp\u003eJohnny finds it interesting that any number becomes palindromic when it is written in an appropriate base.\u003c/p\u003e\n\u003cp\u003eGiven a number N, write a program to help Johnny compute the smallest base B such that N is palindromic when written in base B.\u003c/p\u003e\n\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cp\u003eThe first line contains t, the number of test cases (about 1000). Then t test cases follow.\u003c/p\u003e\n\u003cp\u003eEach test case consists of a number N written in one line (1 \u003c\u003d N \u003c\u003d 10\u003csup\u003e10\u003c/sup\u003e).\u003c/p\u003e\n\n\u003ch3\u003eOutput\u003c/h3\u003e\n\u003cp\u003eFor each given number N, print a line containing the smallest base B such that N is palindromic in base B.\u003c/p\u003e\n"}},{"title":"Sample 1","value":{"format":"MD","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\n1\n4\n21\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n3\n2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}