Let's define the period of a word as a word whose length does not exceed that of , and for which there exists a natural number such that is a prefix of t^k (that is, the word formed by concatenating copies of ). For example, the periods of the word xyzxyzx are , xyzxyz, and xyzxyzx.
The first line contains the number of test cases (1 \leq d \leq 10). Each test case is in one line. The line starts with the number n_i (2 \leq n_i \leq 200000) — the length of the -th word. Then, separated by a space, is the word consisting of lowercase Latin letters.
For each test case, output a single number in a separate line — the minimum period length of a word obtained by removing one letter from the original word.
Primer 1
For the word in the test, the resulting words, their minimal periods, and their lengths are as follows:
— — length ;
— — length ;
— — length ;
— — length ;
— — length ;
— — length ;
— — length ;
— — length ;
Thus, the smallest length is , which is the answer for the sample test.